#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a > b) swap(a, b);
  if (a == 0) return b;
  return gcd(b % a, a);
}
bool mod(long double a, long double b) { return a / b - floor(a / b); }
long long lcm(long long a, long long b, long long c) {
  a = a * b / gcd(a, b);
  c = a * c / gcd(a, c);
  return c;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long i, j, first, n, a, b, c;
  cin >> n;
  if (n <= 2) {
    cout << n << '\n';
  } else if (n % 2 == 1) {
    a = n;
    b = n - 1;
    c = n - 2;
    a = lcm(a, b, c);
    cout << a << '\n';
  } else {
    if (n % 3 == 0) {
      a = n - 2;
    } else {
      a = n;
    }
    b = n - 1;
    c = n - 3;
    c = lcm(a, b, c);
    cout << c << '\n';
  }
  return 0;
}
