#include <bits/stdc++.h>
using namespace std;
bool comp(char& a, char& b);
long long gcd(long long a, long long b);
int factorial(int n);
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int64_t n;
  cin >> n;
  if (n == 1) {
    cout << "1";
  } else if (n == 2) {
    cout << "2";
  } else if (n == 3) {
    cout << "6";
  } else if (n % 2 == 1) {
    int64_t ans = n * (n - 1) * (n - 2);
    cout << ans;
  } else {
    int64_t k1 = n - 1, k2 = n - 3;
    if (gcd(n, k2) > 1) {
      n--;
      k1--;
    }
    int64_t ans = n * k1 * k2;
    cout << ans << endl;
  }
  return 0;
}
int factorial(int n) {
  int result = 1;
  for (int i = 2; i <= n; ++i) {
    result *= i;
  }
  return result;
}
bool comp(char& a, char& b) { return a > b; }
long long gcd(long long a, long long b) {
  long long nod = 1L;
  long long tmp;
  if (a == 0L) return b;
  if (b == 0L) return a;
  if (a == b) return a;
  if (a == 1L || b == 1L) return 1L;
  while (a != 0 && b != 0) {
    if (((a & 1L) | (b & 1L)) == 0L) {
      nod <<= 1L;
      a >>= 1L;
      b >>= 1L;
      continue;
    }
    if (((a & 1L) == 0L) && (b & 1L)) {
      a >>= 1L;
      continue;
    }
    if ((a & 1L) && ((b & 1L) == 0L)) {
      b >>= 1L;
      continue;
    }
    if (a > b) {
      tmp = a;
      a = b;
      b = tmp;
    }
    tmp = a;
    a = (b - a) >> 1L;
    b = tmp;
  }
  if (a == 0)
    return nod * b;
  else
    return nod * a;
}
