import std.stdio; import std.string; import std.conv; void main(){ auto n = readln.chomp.to!ulong; for(auto k = 2; 2 ^^ (k - 1) <= n; k++){ if(kbonacci(k, n)){ writeln(k); return; } } writeln(-1); } bool kbonacci(int k, ulong n){ auto a = new ulong[k]; a[k - 1] = 1; ulong s = 1; int i = 0; while(s < n){ a ~= s; s = s * 2 - a[i]; i++; } return s == n; }