#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans;
  while (~scanf("%lld", &n)) {
    if (n < 3)
      printf("%lld\n", n);
    else {
      if (n == 6) {
        printf("60\n");
        continue;
      }
      if (n & 1)
        ans = n * (n - 1) * (n - 2);
      else {
        if (n % 3)
          ans = n * (n - 1) * (n - 3);
        else
          ans = (n - 2) * (n - 1) * (n - 3);
      }
      printf("%lld\n", ans);
    }
  }
}
