from itertools import product
count = 0
k = 0
for i in product('АГЕИЛНРТ', repeat=5):
    a = ''.join(i)
    count += 1
    if (a.count('Н')==1 or a.count('Н')==2) and a[0]!='Т' and (count % 2 == 1):
        k += 1
print(k)
