N = input().strip() ans = 0 for a1 in range(1,10): a1 = str(a1) M = a1+a1+"0"*7+a1+a1 if len(M)