#include <bits/stdc++.h>
using namespace std;
bool check(int a, int b, int c) {
  int r1 = 0, r2 = 0;
  if (a % 3 == 0) r1++;
  if (b % 3 == 0) r1++;
  if (c % 3 == 0) r1++;
  if (a % 2 == 0) r2++;
  if (b % 2 == 0) r2++;
  if (c % 2 == 0) r2++;
  return !(r1 > 1 || r2 > 1);
}
int main() {
  long long n;
  cin >> n;
  long long ret;
  if (n == 1)
    ret = 1;
  else if (n == 2)
    ret = 2;
  else if (n % 2 != 0)
    ret = n * (n - 1) * (n - 2);
  else {
    ret = check(n, n - 1, n - 3) ? n * (n - 1) * (n - 3) : 0;
    ret = check(n - 1, n - 2, n - 3) ? max(ret, (n - 1) * (n - 2) * (n - 3))
                                     : ret;
  }
  cout << ret << endl;
}
