#include <bits/stdc++.h>
using namespace std;
int arr[1000005];
long long a1[9];
long long a2[9];
char kalimat[100005];
int main() {
  long long sisa1, sisa2, a, b, temp, kelompok, jum, i;
  scanf("%lld", &a);
  getchar();
  if (a <= 4) {
    if (a == 4) {
      cout << "12" << endl;
    } else if (a == 3) {
      cout << "6" << endl;
    } else if (a == 2) {
      cout << "2" << endl;
    } else if (a == 1) {
      cout << "1" << endl;
    }
  } else if (a % 2 == 0) {
    if (a % 3 == 0) {
      cout << (a - 1) * (a - 2) * (a - 3) << endl;
    } else
      cout << a * (a - 1) * (a - 3) << endl;
  } else {
    cout << a * (a - 1) * (a - 2) << endl;
  }
}
