import std.algorithm; import std.array; import std.conv; import std.math; import std.range; import std.stdio; import std.string; import std.typecons; T read(T)() { return readln.chomp.to!T; } T[] reads(T)() { return readln.split.to!(T[]); } alias readint = read!int; alias readints = reads!int; int calc(int n) { // 三角数 auto g = recurrence!((a, n) => a[n-1] + n)(0).drop(1); auto t = g.until!(e => e > n).array; auto sorted = assumeSorted(t); if (sorted.canFind(n)) return 1; foreach (x; sorted) { if (sorted.canFind(n - x)) return 2; } return 3; } void main() { int n = readint; writeln(calc(n)); }