#P39. [KBC002G] Set
[KBC002G] Set
Source
This problem is adapted from Long Long OJ. All rights reserved.
Problem Background
The 'empty set' should be denoted by
\varnothing
(i.e., ).(by somebody)
In the math class, Teacher Xu gave Alice a problem: Given the set , define the cumulative product of a set as the product of all elements in the set.
Specifically, the cumulative product of the empty set is . How many subsets of set have an even cumulative product.
Problem Description
Now Alice has given you another problem: Given a set with distinct elements , how many subsets of have a cumulative product that is even.
Since the answer can be very large, please print the answer taken modulo .
Input Format
- The first line consists a positive integer , representing the number of elements in the set .
- The second line consists of distinct positive integers, representing each element in the set . (not guaranteed to be given in order)
Output Format
Output a single integer representing the number of subsets that meet the conditions.
Ssmples
4
1 2 4 3
13
3
2 4 6
8
Sample 1 Explanation
The sets that satisfy the conditions: $\varnothing, \left\{2\right\}, \left\{4\right\}, \left\{1,2\right\}, \left\{1,4\right\}, \left\{2,3\right\}, \left\{2,4\right\}, \left\{3,4\right\}, \left\{1,2,3\right\}, \left\{1,2,4\right\}, \left\{1,3,4\right\}, \left\{2,3,4\right\}, \left\{1,2,3,4\right\}$.
Data Range
- For of the data, all elements in are even numbers.
- For another of the data, .
- For 100% of the data, ensure that , .