n = int(input())
c = 0
for i in range(10000, n + 1):
w = i // 10000 % 10
q = i // 1000 % 10
b = i // 100 % 10
s = i // 10 % 10
g = i // 1 % 10
if w % 2 == 0 and q % 2 == 0 and b % 2 == 0 and s % 2 == 0 and g % 2 == 0:
c += 1
print(c)
/**************************************************************
Problem: 1745
User: admin
Language: Python
Result: Accepted
Time:182 ms
Memory:34480 kb
****************************************************************/