#include <bits/stdc++.h>
using namespace std;
long long ucln(long long a, long long b) {
  int t;
  while (b != 0) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
int main() {
  long long n, res = 1, j;
  cin >> n;
  if (n < 3) {
    cout << n;
    return 0;
  }
  if (n % 6 == 0) {
    n--;
    n = n * (n - 1) * (n - 2);
    cout << n;
    return 0;
  }
  res = n * (n - 1);
  j = n - 2;
  while (ucln(j, res) != 1) j--;
  res = res * j;
  cout << res;
}
