#include<iostream>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<string>
using namespace std;
int main()
{
int n;
cin >> n;
int max = -1;
int t = 0;
for (int i = 1; i <n; i++)
{
t = 0;
for (int j = 2; j < i; j++)
{
if (i % j == 0 || (n - i) % j == 0)
{
break;
}
if (j == i - 1)
{
t = 1;
}
}
if (max < i * (n - i)&&t==1)
{
max = i * (n - i);
}
}
cout << max;
return 0;
}