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