Panda and XOR
Practice
4.1 (187 votes)
Ad Hoc
Algorithms
Approved
Dynamic programming
Medium
Open
Problem
27% Success 12915 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Little Black Panda is mad about XOR operation. Presently he has gone mad and he won't stop performing XOR operation on various numbers.
Given an array of N numbers, for each subset of the array Little Panda performs MAXOR operation for the subset. MAXOR operation means that he finds XOR of all elements in that subset (if the subset is [1,2,3] then MAXOR is 1^2^3=0) . Little Panda is now exhausted and wants to do something else. Little Panda wants to pick any two subsets the MAXOR of whose are same. Little Panda needs to find the number of selections that he can make. He is very very weak in programming so he wants the answer from you. Please help little panda in finding out his query.
Since the output can be very large output it modulo 1000000007.

Input Format
The first line contains N i.e. the length of the array.
N lines follow, each containing a non-negative integer.

Output Format
Output Little Panda's Query in a single line.

Constraints
1 <= N <= 100000
0 <= A[i] <= 100
(where A[i] denotes the value of array element)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
20 votes
Tags:
Dynamic ProgrammingMediumReady
Points:30
6 votes
Tags:
AlgorithmsDynamic Programming2D dynamic programming
Points:30
54 votes
Tags:
2D dynamic programmingAlgorithmsDynamic ProgrammingMediumPermutation and combination