N = gets.to_i
def first_sum(s)
  sum = ([*1..s].map {|t| Math.cos((2*Math::PI*t*N).quo(s))}.inject(:+) + 0.5).floor
  sum -= sum / s * 1
  sum != 0 && N / sum > sum ? 0 : sum
end
p [*1..N].map {|s| first_sum(s)}.inject(:+)
