#include <bits/stdc++.h>
using namespace std;
long long int lcm(long long int a, long long int b) {
  long long int c = a * b;
  while (a != b) {
    if (a > b)
      a = a - b;
    else
      b = b - a;
  }
  return c / a;
}
int main() {
  long long int n, sum = 0, max = 0, p, done = 0;
  cin >> n;
  if (n == 1 || n == 2) {
    cout << n;
    return 0;
  }
  if (n == 3) {
    cout << 6;
    return 0;
  }
  for (int i = 0; i <= 3; i++) {
    for (int j = 0; j <= 3; j++) {
      for (int k = 0; k <= 3; k++) {
        sum = lcm((n - i), lcm((n - j), (n - k)));
        if (i != j && j != k && i != k && max < sum) {
          max = sum;
        }
      }
    }
  }
  cout << max;
}
