import sys input = sys.stdin.readline def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] N = int(input()) Y = make_divisors(N) ans = 0 for y in Y: tmp = N//y if y==1: cnt = (tmp+1)//2-1 #print(cnt) if cnt>0: ans += cnt else: break else: cnt = (tmp+y)//(y+1)-1 #print(cnt) if cnt>0: ans += cnt else: break print(ans)