#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  cout << (n <= 2  ? n
           : n % 2 ? (long long)n * (n - 1) * (n - 2)
           : n % 3 ? (long long)n * (n - 1) * (n - 3)
                   : (long long)(n - 1) * (n - 2) * (n - 3))
       << '\n';
  return 0;
}
