#include <bits/stdc++.h>
using namespace std;
long long m, flag, inf, v;
long long t, c = 0, next;
int main() {
  long long m;
  scanf("%lld", &m);
  if (m < 3)
    printf("%lld\n", m);
  else {
    if (m % 2 != 0)
      printf("%lld", m * (m - 1) * (m - 2));
    else {
      if (m % 3 == 0)
        printf("%lld\n", (m - 1) * (m - 2) * (m - 3));
      else {
        printf("%lld\n", m * (m - 1) * (m - 3));
      }
    }
  }
}
