#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long n;
  cin >> n;
  if (n & 1) {
    if (n >= 3)
      cout << n * (n - 2) * (n - 1);
    else
      cout << n;
  } else if (n >= 4) {
    if (n % 3)
      cout << n * (n - 1) * (n - 3);
    else
      cout << (n - 1) * (n - 2) * (n - 3);
  } else if (n == 3)
    cout << 6;
  else
    cout << n;
  return 0;
}
