n = int(input()) x = 1 ans = 0 while x*x <= n: if n % x != 0: x += 1 continue o = n // x cnt = 1 for i in range(60): x_bit = (x >> i) & 1 o_vit = (o >> i) & 1 if x_bit == 1 and o_vit == 1: cnt *= 2 cnt %= 10**9+7 if x_bit == 1 and o_vit == 0: cnt = 0 ans += cnt ans %= 10**9+7 x += 1 print(ans // 2)