#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
void amfetamin() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
}
int gcd(long long a, long long b) {
  while (b > 0) {
    long long smurf = a;
    a = b;
    b = smurf % b;
  }
  return a;
}
int main() {
  amfetamin();
  long long n;
  cin >> n;
  long long sol;
  if (n == 1) {
    cout << 1;
    return 0;
  }
  if (n == 2) {
    cout << 2;
    return 0;
  }
  if (n % 2 == 1) {
    sol = n * (n - 1) * (n - 2);
    cout << sol;
  } else {
    long long mx = (n - 1) * (n - 2) * (n - 3);
    long long cur = n * (n - 1);
    for (long long i = n - 2; i >= 0; i--) {
      if (gcd(i, n) == 1 && gcd(i, n - 1) == 1) {
        cur *= i;
        break;
      }
    }
    cout << (long long)max(mx, cur);
  }
}
