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