#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
int main() {
  long long n, a1;
  scanf("%lld", &n);
  a1 = n;
  if (n == 1) {
    cout << "1" << endl;
    return 0;
  }
  if (n == 2) {
    cout << "2" << endl;
    return 0;
  }
  if (n % 2) {
    a1 = n * (n - 1) * (n - 2);
    cout << a1 << endl;
  } else {
    a1 = (n - 1) * (n - 2) * (n - 3);
    long long a2 = n * (n - 1) * (n - 2) / gcd(n * (n - 1), n - 2);
    long long a3 = n * (n - 1) * (n - 3) / gcd(n * (n - 1), n - 3);
    a2 = max(a2, a3);
    cout << max(a1, a2);
    return 0;
  }
}
