def match(k):
d=str(k)
s=list(d)
e=''
if len(s)>len(set(s)): return 0
for i in d:
if i in '02468': e=e+'1'
else: e=e+'0'
if '00' in e: return 0
if '11' in e: return 0
return 1
N=int(input('N='))
if 1<N<10:
print(sum([1 for i in range(10**(N-1),10**N,5) if match(i)]))
else:
print('figvam!')
Ввод: 6
Вывод: 1296