#include <iostream>

using namespace std;

unsigned long n;

int main() {
//  freopen("factor.in","r",stdin);
//  freopen("factor.out","w",stdout);
  cin >> n;
  if (n<=3) {
    cout << n << endl;
    return 0;
  }

  unsigned long k=1;
  while (k<=n) k*=2;
  k/=2;

  unsigned long p=k/2*3;
  if (p<=n) k = p;

  cout << k << endl;

  return 0;
}
