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