from itertools import product
count = 0
for ops in product([1,2,3], repeat=6):
    x = 1
    for op in ops:
        if op in [1,2]:
            x += op
        else:
            x *= 2
    if x == 20:
        count += 1
        #print(ops)
print(count)
