#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int N;
long long k, k1;

int main()
{
	freopen("factor.in", "rt", stdin);
	freopen("factor.out", "wt", stdout);

	scanf("%d", &N);

	k = 1;
	while (k <= N)
		k *= 2;

	k/=2;

	k1 = k/2 * 3;

	if (k1 <= N)
		printf("%lld", k1);
	else
		printf("%lld", k);


	return 0;
}