import sys sys.setrecursionlimit(10 ** 6) from bisect import * from collections import * from heapq import * int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def SI(): return sys.stdin.readline()[:-1] def MI(): return map(int, sys.stdin.readline().split()) def MI1(): return map(int1, sys.stdin.readline().split()) def MF(): return map(float, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LI1(): return list(map(int1, sys.stdin.readline().split())) def LF(): return list(map(float, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] dij = [(0, 1), (1, 0), (0, -1), (-1, 0)] # (底,指数)を返す # 18=2**1 * 3**2なので[(2,1),(3,2)] def PrimeFactorization(x): def plist(x): if x < 2: return [] if x & 1 == 0: return [2] + plist(x // 2) for p in range(3, x + 1, 2): if x % p == 0: return [p] + plist(x // p) if p ** 2 > x: return [x] pl = plist(x) pp, ee = [], [] for p in pl: if not pp or p != pp[-1]: pp += [p] ee += [0] ee[-1] += 1 return [(p, e) for p, e in zip(pp, ee)] def gcd(a, b): while b: a, b = b, a % b return a def expsum(p, e): return (pow(p, e + 1) - 1) // (p - 1) def main(): n = II() c = (n - 1) * n // 2 g = gcd(n, c) ans = 1 for p, e in PrimeFactorization(g): ans *= expsum(p, e) print(ans) main()