#include <bits/stdc++.h>
using namespace std;
int GCD(int a, int b) { return ((b == 0) ? a : GCD(b, a % b)); }
int main() {
  long long n;
  cin >> n;
  if (n == 1 || n == 2) return cout << n, 0;
  if (n % 6 == 0) return cout << (n - 1) * (n - 2) * (n - 3), 0;
  if (n % 2) return cout << n * (n - 1) * (n - 2), 0;
  cout << n * (n - 1) * (n - 3);
}
