#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (a > 0 && b > 0)
    if (a > b)
      a %= b;
    else
      b %= a;
  return a + b;
}
int main(int argc, char* argv[]) {
  int n;
  cin >> n;
  if (n < 3)
    cout << n << endl;
  else {
    long long res = (long long)n;
    for (int a = n; ((long long)a) * ((long long)a) * ((long long)a) > res; a--)
      for (int b = a; ((long long)a) * ((long long)b) * ((long long)b) > res;
           b--) {
        long long lcm_a_b = ((long long)a) * ((long long)b) / gcd(a, b);
        for (int c = b; lcm_a_b * ((long long)c) > res; c--) {
          long long lcm_a_b_c = lcm_a_b * ((long long)c) / gcd(lcm_a_b, c);
          res = max(res, lcm_a_b_c);
        }
      };
    cout << res << endl;
  }
  return 0;
}
