#include <bits/stdc++.h>
int main(void) {
  long long int n, j = 3, i = 0;
  scanf("%lld", &n);
  long long int m = n - 3;
  if (n <= 2) {
    printf("%lld", n);
  } else {
    if (n % 2 == 1) {
      printf("%lld", n * (n - 1) * (n - 2));
    } else {
      while (m > n / 2) {
        while (((m % j == 0) && ((n % j == 0) || ((n - 1) % j == 0))) != 1) {
          if (j + 2 >= m / 2) {
            if (m * n * (n - 1) > (n - 1) * (n - 2) * (n - 3)) {
              printf("%lld", m * n * (n - 1));
            } else {
              printf("%lld", (n - 1) * (n - 2) * (n - 3));
            }
            i++;
            exit(0);
          } else {
            j += 2;
          }
        }
        j = 3;
        m -= 2;
      }
      if (i == 0) {
        if (n < 6) {
          printf("%lld", n * (n - 1) * (n - 2) / 2);
        } else {
          printf("%lld", (n - 1) * (n - 2) * (n - 3));
        }
      }
    }
  }
  return 0;
}
