N = int(input()) ans = 0 p = 2 while N * (p * 9 + 9) > p * p - 1: flag = 1 for a in reversed(range(min(p, 10))): b = max(- ((- p * p + 1 + N * p * a) // N), 0) if 0 <= b < min(p, 10): tmp = (min(p, 10) - b - 1) if a < b: tmp += 1 ans += tmp #print(p, a, b, tmp) else: break p += 1 print(ans)