#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int big, long long int small) {
  if (big % small == 0) return small;
  gcd(small, big % small);
}
int main() {
  long int t;
  t = 1;
  while (t--) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long int n;
    cin >> n;
    long long int x, y, z, i, j;
    if (n == 1)
      cout << "1" << endl;
    else if (n == 2) {
      cout << "2" << endl;
    } else {
      if (n % 2 == 1)
        cout << n * (n - 1) * (n - 2) << endl;
      else {
        for (i = n - 2; i >= 1; i--) {
          x = gcd(n, i);
          y = gcd(n - 1, i);
          if (x == 1 && y == 1) {
            if (n * (n - 1) * i >= (n - 1) * (n - 2) * (n - 3))
              cout << n * (n - 1) * i << endl;
            else
              cout << (n - 1) * (n - 2) * (n - 3) << endl;
            goto xx;
          }
        }
      }
    xx:;
    }
  }
}
