#include <bits/stdc++.h>
using namespace std;
long long f(long long n) {
  if (n < 3) return n;
  if (n % 2 == 1) return n * (n - 1) * (n - 2);
  long long r = (n * (n - 1) * (n - 2)) / 2;
  long long t = 0;
  if (n % 3 != 0) {
    t = n * (n - 1) * (n - 3);
    if (t > r) r = t;
  }
  --n;
  t = n * (n - 1) * (n - 2);
  if (r < t) r = t;
  return r;
}
int main() {
  long long a, b, c, n;
  cin >> n;
  cout << f(n) << endl;
}
