local mfl = math.floor local n = io.read("*n") local t = {} local max = 4471 local f = false for i = 1, max do t[i] = mfl(i * (i + 1) / 2) if t[i] == n then f = true print(1) break end end if not f then for i = 1, max do for j = 1, max do if t[i] + t[j] == n then print(2) f = true break end end if f then break end end end if not f then print(3) end