#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
  bool operator<(const point &a) const { return x > a.x; }
};
priority_queue<int> que;
long long n, s1, s2;
int a[20] = {0, 1, 2, 6, 12, 60, 60};
long long b[20] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};
int main() {
  while (~scanf("%d", &n)) {
    if (n < 7) {
      printf("%d\n", a[n]);
      continue;
    }
    s1 = n * (n - 1) * (n - 2);
    if (n % 2 == 0) {
      s1 = s1 / 2;
      for (int i = 0; i < 10; i++) {
        if (n % b[i] != 0) {
          s2 = n * (n - 1) * (n - b[i]);
          break;
        }
      }
      if (s2 > s1) s1 = s2;
      s2 = (n - 1) * (n - 2) * (n - 3);
      if (s2 > s1) s1 = s2;
    }
    printf("%lld\n", s1);
  }
  return 0;
}
