P3067 [USACO12OPEN] Balanced Cow Subsets G

Description

Farmer John's owns N cows (2

Input Format

\* Line 1: The integer N. \* Lines 2..1+N: Line i+1 contains M(i).

Output Format

\* Line 1: The number of balanced subsets of cows.

Explanation/Hint

There are 4 cows, with milk outputs 1, 2, 3, and 4. There are three balanced subsets: the subset {1,2,3}, which can be partitioned into {1,2} and {3}, the subset {1,3,4}, which can be partitioned into {1,3} and {4}, and the subset {1,2,3,4} which can be partitioned into {1,4} and {2,3}.