题库练习 (Zero XOR Subset)-less
← 上一题 下一题 →

A12305 | (Zero XOR Subset)-less

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You are given an array $a_1, a_2, \dots, a_n$ of integer numbers.

Your task is to divide the array into the maximum number of segments in such a way that:

- each element is contained in exactly one segment;
- each segment contains at least one element;
- there doesn't exist a non-empty subset of segments such that bitwise XOR of the numbers from them is equal to $0$ .

Print the maximum number of segments the array can be divided into. Print -1 if no suitable division exists.

输入格式

The first line contains a single integer $n$ ( $1 \le n \le 2 \cdot 10^5$ ) — the size of the array.

The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ( $0 \le a_i \le 10^9$ ).

输出格式

Print the maximum number of segments the array can be divided into while following the given constraints. Print -1 if no suitable division exists.

输入输出样例

输入 #1
4
5 5 7 2
输出 #1
2
输入 #2
3
1 2 3
输出 #2
-1
输入 #3
3
3 1 10
输出 #3
3
C++ 编辑器
输入
输出