#include <bits/stdc++.h>
using namespace std;
int n;
long long ans = 1;
int gcd(int x, int y) { return (y == 0) ? (x) : (gcd(y, x % y)); }
int main() {
  cin >> n;
  if (n == 1 || n == 2) {
    cout << n;
  } else if (n % 2 == 1) {
    ans = (long long)((long long)n * (n - 1) * (n - 2));
    cout << ans;
  } else {
    ans = (long long)n * (n - 1) * (n - 3);
    ans /= (long long)gcd(n, n - 3);
    long long ans1 = (long long)(n - 3) * (n - 1) * (n - 2);
    cout << max(ans1, ans);
  }
  return 0;
}
