#include <bits/stdc++.h>
using namespace std;
long long int solve(long long int n) {
  long long int ans;
  if (n < 3)
    ans = n;
  else if (n == 6)
    ans = 60;
  else if (n % 2)
    ans = n * (n - 1) * (n - 2);
  else {
    ans = n * (n - 1) * (n - 3);
    if (n % 3 == 0 && (n - 3) % 3 == 0) ans /= 3;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  cout << max(solve(n), solve(n - 1));
  return 0;
}
