n = int(input()) ans = 0 for a in range(0, 10): for b in range(0, 10): if a == b: continue ok = max(a, b) ng = 10 ** 9 + 1 while ng - ok > 1: mid = (ok + ng) // 2 if mid * mid - 1 < n * (mid * a + b): ok = mid else: ng = mid ans += ok - max(a, b) print(ans)