from itertools import product
j = 0
for i in product("AB123", repeat = 8):
k = ''.join(i)
if(k.count("A")==2 and k.count("B")==0):
j += 1
elif(k.count("A")==1 and k.count("B")==1):
j += 1
elif(k.count("A")==0 and k.count("B")==2):
j += 1
print(j)