In the event of technical difficulties with Szkopuł, please contact us via email at email@example.com.
If you are familiar with IRC chat, the support team is also reachable on PIRC network (
#szkopul channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
Byteman is a scientist who investigates creation of crystals consisting of atoms of different elements. He has designed a special process for creating crystals and has discovered a formula specifying the amount of elements that can be used to create a crystal. Now, he wonders how many different crystals can be created in such process.
For non-negative integers and , by we shall denote their bit-wise xor. The basic xor for single bits is defined by: , .
Byteman knows different elements that can be used to create crystals - these are numbered from to . For each element there is an upper bound on number of atoms of this element that can be used to create a crystal. Byteman can create one unique crystal composed of atoms of the element (for ), if and only if:
Note that the last condition is quite obvious and essentially states that every crystal is composed of at least one atom.
Write a programme which:
The first line of the standard input contains the number of elements , . The second, last line of the standard input contains positive integers , separated by single spaces, .
Your programme should write one integer to the standard output - total number of different crystals that can be created. You can assume that this number is less than .
For the input data:
3 2 1 3
the correct result is:
And the following are every possible numbers of atoms of each particular element: , , , , .
Task author: Jakub Pawlewicz.