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