def calc(x) (1..100000).bsearch {|k| x < k*(k+1)/2 }-1 end def bye(x) p x exit end n = gets.to_i 0.upto(4500) do |k| bye 1 if k*(k+1)/2 == n end 1.upto(4500) do |k| rk = k*(k+1)/2 k.upto(4500) do |l| rl = l*(l+1)/2 bye 2 if rl + rk == n end end bye 3