import std.algorithm,
       std.string,
       std.array,
       std.range,
       std.stdio,
       std.conv;

void main() {
  int n = readln.chomp.to!int;
  int m = 1;

  while (m < n) {
    m *= 2;
  }

  writeln(m / (m == n ? 1 : 2));
}
