#include <bits/stdc++.h>
using namespace std;
int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  long long int n, c = 1, l;
  cin >> n;
  long long int ans = n;
  if (n == 1 || n == 2) {
    cout << n;
    return 0;
  }
  if (n % 6 == 0) ans = (n - 1) * (n - 2) * (n - 3);
  for (int i = (n - 1); (c != 3) && (n % 6 != 0); i--) {
    l = gcd(n, i);
    if (l == 1) {
      ans = ans * i;
      c++;
    }
  }
  cout << ans;
  return 0;
}
