No.183 Fun Exclusive OR (EASY)
タグ : / 解いたユーザー数 439
作問者 :
紙ぺーぱー
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もしくは右上の雲マークをクリックしてアカウントを作成してください。