#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) { return x ? gcd(y % x, x) : y; }
int main(void) {
  long long N;
  cin >> N;
  long long x, y, z;
  long long ans = 0;
  for (x = N; x * x * x > ans; x--)
    for (y = x; x * y * y > ans; y--)
      for (z = y; x * y * z > ans; z--) {
        if (gcd(x, y) == 1 && gcd(x, z) == 1 && gcd(y, z) == 1) ans = x * y * z;
      }
  cout << ans << endl;
  return 0;
}
