N = gets.to_i sum = (1 + (N - 1)) * (N - 1) / 2 ans = 0 map = {} 1.upto(Math.sqrt(N).floor) {|i| if N % i == 0 and sum % i == 0 if not map.include?(i) ans += i map[i] = 1 end if (not map.include?(N / i)) and sum % (N / i) == 0 ans += (N / i) map[N / i] = 1 end end } puts ans