# 愚直解 import sys from itertools import permutations input = sys.stdin.readline n = int(input()) ans = 0 for a, b in permutations([*range(10)], 2): min_p = max(a, b) + 1 if(min_p ** 2 >= n * (min_p * a + b) + 1): continue p = min_p while(p ** 2 < n * (p * a + b) + 1): p += 1 ans += p - min_p print(ans)