PivotOJ

Deck-Building Game

시간 제한: 2000ms메모리 제한: 1024MB출처: ICPC Asia Jakarta Regional 2023BOJ 32086

문제

You are playing a deck-building game with your friend. There are NN cards, numbered from 11 to NN. Card ii has the value of AiA_i.

You want to build two decks; one for you and one for your friend. A card cannot be inside both decks, and it is allowed to not use all NN cards. It is also allowed for a deck to be empty, i.e. does not contain any cards.

The power of a deck is represented as the bitwise XOR of the value of the cards in the deck. The power of an empty deck is 00.

The game is balanced if both decks have the same power.

Determine the number of ways to build two decks such that the game is balanced. Two ways are considered different if one of the decks contains at least one different card. Since the answer can be very large, calculate the answer modulo 998244353998\, 244\, 353.

입력

The first line consists of an integer NN (2 ≤ N ≤ 100\, 000).

The following line consists of NN integers AiA_i (1 ≤ A_i ≤ 100\, 000).

출력

Output an integer representing the number of ways to build two decks such that the game is balanced. Output the answer modulo 998244353998\, 244\, 353.

예제

예제 1

입력
4
16 12 4 8
출력
9

예제 2

입력
4
1 2 4 8
출력
1

예제 3

입력
2
1 1
출력
5

예제 4

입력
6
1 1 1 2 2 2
출력
169
코드를 제출하려면 로그인하세요.