#include <bits/stdc++.h>
using namespace std;
int prime[1000005];
int ans[5];
int idx;
set<int> s, s1;
set<int>::iterator it;
int main() {
  int i, j;
  for (i = 2; i <= 1000000; i++) {
    if (prime[i] == 1) continue;
    for (j = i + i; j <= 1000000; j += i) prime[j] = 1;
  }
  int n;
  scanf("%d", &n);
  if (n == 1)
    printf("1\n");
  else if (n == 2)
    printf("2\n");
  else {
    long long sum = n;
    for (i = 2; i < n; i++) {
      if (n % i == 0) s.insert(i);
    }
    int countt = 0;
    for (i = n - 1; i >= 1; i--) {
      bool no = 0;
      for (it = s.begin(); it != s.end(); it++) {
        if (i % (*it) == 0) {
          no = 1;
          break;
        }
      }
      if (!no) {
        sum *= (long long)i;
        countt++;
      }
      if (countt == 2) break;
    }
    long long sum1 = n - 1;
    for (i = 2; i < n - 1; i++) {
      if ((n - 1) % i == 0) s1.insert(i);
    }
    countt = 0;
    for (i = n - 2; i >= 1; i--) {
      bool no = 0;
      for (it = s1.begin(); it != s1.end(); it++) {
        if (i % (*it) == 0) {
          no = 1;
          break;
        }
      }
      if (!no) {
        sum1 *= (long long)i;
        countt++;
      }
      if (countt == 2) break;
    }
    printf("%I64d\n", max(sum, sum1));
  }
  return 0;
}
