405979: GYM102201 G Good Set
Memory Limit:1024 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
G. Good Settime limit per test1 secondmemory limit per test1024 megabytesinputstandard inputoutputstandard output
Seunghyun is a mathematician, and he likes good jokes.
For a set U = {0, 1, ..., 2k - 1}, a nonempty subset is good if it satisfies the following rules.
- for any , their bitwise-and should be in S.
- for any , their bitwise-or should be in S.
You are given n distinct integers in [0, 2k - 1] range. Find the number of good sets which contains all n integers.
InputThe first line contains two integers k, n. (1 ≤ k ≤ 7, 0 ≤ n ≤ 2k)
The next line contains n distinct integers a1, a2, ..., an(0 ≤ ai ≤ 2k - 1).
OutputPrint a single integer denoting the number of good sets.
ExamplesInput2 1Output
0
7Input
4 3Output
1 2 7
29