#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., \varnothing).

(by somebody)

In the math class, Teacher Xu gave Alice a problem: Given the set M={1,2,3,4}M=\left\{1,2,3,4\right\}, define the cumulative product of a set as the product of all elements in the set.

Specifically, the cumulative product of the empty set \varnothing is 00. How many subsets of set MM have an even cumulative product.

Problem Description

Now Alice has given you another problem: Given a set MM with nn distinct elements m1,m2,,mnm_1, m_2, \ldots, m_n, how many subsets of MM have a cumulative product that is even.

Since the answer can be very large, please print the answer taken modulo 107+7\bm{10^7+7}.

Input Format

  • The first line consists a positive integer nn , representing the number of elements in the set MM.
  • The second line consists of nn distinct positive integers, representing each element in the set MM. (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 10%10\% of the data, all elements in MM are even numbers.
  • For another 20%20\% of the data, 1n201 \le n \le 20.
  • For 100% of the data, ensure that 1n1061 \le n \le 10^6, 0mi1070 \le m_i \le 10^7.