#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  {
    if (n <= 2)
      printf("%lld\n", n);
    else if (n % 2 == 0) {
      if (n % 3 == 0)
        printf("%lld\n", (n - 1) * (n - 2) * (n - 3));
      else
        printf("%lld\n", n * (n - 1) * (n - 3));
    } else {
      printf("%lld\n", n * (n - 1) * (n - 2));
    }
  }
}
