x = io.read("*n")
ncand = (math.sqrt(1 + 4 * x) - 1) / 2
ncand = math.floor(ncand) - 1
while(ncand * (ncand + 1) < 2 * x) do
  ncand = ncand + 1
end
v = ncand * (ncand + 1) / 2
if((v - x) % 2 == 0) then print(ncand) else print(ncand + 2) end
