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