XOR Operations

시간 제한2초메모리 제한1024 MB

요약
정수 a_i가 주어질 때, b_i와 b_j에 a_i xor a_j를 XOR하는 연산을 반복해 만들 수 있는 서로 다른 수열 B의 가짓수를 998244353으로 나눈 나머지를 구한다.
난이도

어려움10점 중 8점

유형
수학, 비트 연산, 조합론, 그리디
정답자
아직 제출이 없습니다

문제

You are given nn integers a_1,a_2,…,a_na\_1, a\_2, \dots , a\_n. You have a sequence of nn integers B=(b_1,b_2,…,b_n)B = (b\_1, b\_2, \dots , b\_n) which initially are all zeroes.

In one operation, you choose two different indices ii and jj, then simultaneously

  • replace b_ib\_i with b_i⊕a_i⊕a_jb\_i \oplus a\_i \oplus a\_j, and
  • replace b_jb\_j with b_j⊕a_i⊕a_jb\_j \oplus a\_i \oplus a\_j.

Note that ⊕\oplus represents the bitwise XOR operation, which returns an integer whose binary representation has a 11 in each bit position for which the corresponding bits of either but not both operands are 11. For example, 3⊕10=93 \oplus 10 = 9 because (0011)_2⊕(1010)_2=(1001)_2(0011)\_2 \oplus (1010)\_2 = (1001)\_2.

You want to compute the number of different possible sequences BB you can obtain after performing zero or more operations. Since this number might be huge, calculate this number modulo 998,244,353998\\, 244\\, 353.

Two sequences of length nn are considered different if and only if there exists an index ii (1≤i≤n1 ≤ i ≤ n) such that the ii-th element of one sequence differs from the ii-th element of the other sequence.

입력

The first line of input contains one integer nn (2≤n≤200,0002 ≤ n ≤ 200\\, 000). The second line contains nn integers a_1,a_2,…,a_na\_1, a\_2, \dots , a\_n (0≤a_i<2300 ≤ a\_i < 2^{30} for all ii).

출력

Output an integer representing the number of different possible sequences BB you can obtain after performing zero or more operations modulo 998,244,353998\\, 244\\, 353.

예제2

  1. 예제 1

    입력
    3
    1 2 1
    
    예상 출력
    4
    
  2. 예제 2

    입력
    4
    852415 852415 852415 852415
    
    예상 출력
    1