# import系 --- # 入力用 --- INT = lambda: int(input()) MI = lambda: map(int, input().split()) MI_DEC = lambda: map(lambda x: int(x) - 1, input().split()) LI = lambda: list(map(int, input().split())) LI_DEC = lambda: list(map(lambda x: int(x) - 1, input().split())) LS = lambda: list(input()) LSS = lambda: input().split() # コード --- from math import isqrt N = INT() # aとbの最大公約数gcdと、a*x - b*y = 1 の特殊解x, y を返す def extended_gcd(a, b): if a == 0: return b, 0, 1 else: gcd, x, y = extended_gcd(b % a, a) return gcd, y - (b // a) * x, x # 連立合同式を解く def culc(A, B, a, b): _, x, _ = extended_gcd(A, B) return ((A * x) * (b - a) + a) % (A * B) ans = 0 for i in range(2, isqrt(N) + 2): clc = culc(i, i-1, 0, N-(i-1)) x = (N - clc - 1) // (i * (i - 1)) ans += x - 1 if N % i == 0 else x print(ans)