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)以上のとき rootn = isqrt(n) minp = [0]*(rootn+1) for i in range(3,rootn+1,2): if minp[i] != 0: continue for j in range(i,rootn+1,i): if minp[j] == 0: minp[j] = i ans = 0 for p in range(2,rootn + 1): f = p%2 + 1 #遇奇の不一致 fp = [] p_ = p while minp[p_] != 0: mp = minp[p_] fp.append(mp) while p_%mp == 0: p_ //= mp for q in range(f,p,2): r = 2 * p * (p + q) if n < r: break for i in fp: if q%i == 0: break else: ans += n//r #この倍数まで大丈夫 print(ans)