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