from functools import cache from math import isqrt @cache def gcd(a,b): if b == 0: return a return gcd(b,a%b) n = int(input()) #定数倍を考える # #sqrt(n)以上のとき ans = 0 for p in range(1,isqrt(n) + 1): f = p%2 + 1 #遇奇の不一致 for q in range(f,p,2): r = 2 * p * (p + q) if gcd(p,q) != 1: continue ans += n//r #この倍数まで大丈夫 print(ans)