#include <bits/stdc++.h>
inline long long read() {
  long long x = 0, y = 1;
  char a = getchar();
  while (a > '9' || a < '0') {
    if (a == '-') y = -1;
    a = getchar();
  }
  while (a >= '0' && a <= '9') {
    x = (x << 3) + (x << 1) + a - '0';
    a = getchar();
  }
  return x * y;
}
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n == 1)
    putchar('1'), exit(0);
  else if (n == 2)
    putchar('2'), exit(0);
  cout << 1LL * (n - 1) * (n & 1 || n % 3 ? n : 1) *
              (!(n & 1) ? n - 3 : n - 2) * (!(n & 1) && !(n % 3) ? n - 2 : 1);
  return 0;
}
