import core.bitop; import std.algorithm; import std.array; import std.ascii; import std.container; import std.conv; import std.format; import std.math; import std.random; import std.range; import std.stdio; import std.string; import std.typecons; long g(long n, long r) { long v = 1; foreach (i; 0 .. n) { v *= i + 1; } foreach (i; 0 .. r) { v /= i + 1; } foreach (i; 0 .. (n - r)) { v /= i + 1; } return v; } long f(long n) { long cnt = 0; foreach (i; 1 .. n) { long v = g(n, i); if (v % 2 == 0) { ++cnt; } } return cnt; } int a(long n) { int cnt = 0; long two = 2; while (two <= n) { cnt += n / two; two <<= 1L; } return cnt; } void main() { long n = readln.chomp.to!long; // stderr.writeln = n.f; int cnt = n.a; int ans = 1; for (long ite = n / 2; 0 <= ite; --ite) { int cnt2 = ite.a; int cnt3 = (n - ite).a; if (cnt2 + cnt3 < cnt) { break; } ++ans; } (n - ans).writeln; }