Let
You are given a list of
Each constraint is a bitwise operator followed by two numbers: the second input and the output of the bitwise operation.
Any of the following bitwise operators may appear in a given constraint: AND
, OR
, NAND
, NOR
.
For example, a constraint could be AND 7 3
, meaning that
How many solutions for
Input Specification
The first line contains an integer
The next
Output Specification
Output the number of solutions for
Sample Input 1
Copy
1
AND 0 1
Sample Output 1
Copy
0
Sample Input 2
Copy
4
AND 1 1
OR 12287 16383
NAND 6 1152921504606846975
NOR 1152921504606844927 0
Sample Output 2
Copy
512
Comments