問題一覧 > 通常問題

No.183 Fun Exclusive OR (EASY)

レベル : / AI推定難易度 : 900 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 439
作問者 : 紙ぺーぱー
お気に入りにしたユーザー ProblemId : 470 / 自分の提出
問題文最終更新日: 2026-06-25 04:06:55
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 97 (順位表) の他の問題:

Problem Statement

kamipeipaa is not very smart, so he has started studying. The problem kamipeipaa is currently solving is as follows.

You have found $N$ switches. The integer $A_i$ is written on the $i$-th switch. By pressing the $i$-th switch, you can perform the following operation on an integer $X$:
$X = X \oplus A_i$
Here, $\oplus$ denotes the bitwise XOR operator (reference).
A switch that has been pressed once can never be used again.
$X$ is initially $0$.
How many different integers can you make?

Please solve this problem together with kamipeipaa.

Input

$N$
$A_1$ $A_2$ ... $A_N$

The first line gives the number of switches $N(1 \le N \le 5000)$.
The second line gives the integers $A_i(1 \le A_i \le 16384(2^{14}))$ written on the switches, separated by spaces.

Output

Output the total number of integers that can be made on one line. Do not forget the newline.

Sample

Sample 1
Input
2
1 2 
Output
4

$0 = 0$
$1 = 0 \oplus 1$
$2 = 0 \oplus 2$
$3 = 0 \oplus 1 \oplus 2$
These 4 different values can be made.

Sample 2
Input
6
1 1 4 5 1 4
Output
4

Even when 6 integers are given, there are cases where only 4 different values can be made.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。