#include <bits/stdc++.h>
using namespace std;
long long find_set(long long v, vector<long long> &p) {
  if (v == p[v]) return v;
  return p[v] = find_set(p[v], p);
}
void union_set(long long a, long long b, vector<long long> &p) {
  a = find_set(a, p);
  b = find_set(b, p);
  if (a != b) {
    p[b] = a;
  }
}
bool mysort(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first >= b.first;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
void solve() {
  long long n;
  cin >> n;
  if (n == 1 || n == 2) {
    cout << n << endl;
    return;
  }
  if (n == 6) {
    cout << "60" << endl;
    return;
  }
  if (n % 2 == 0) {
    cout << max((n - 1) * lcm(n, n - 3),
                max((n - 1) * lcm(n, n - 2), (n - 1) * (n - 2) * (n - 3)))
         << endl;
    return;
  }
  cout << n * (n - 1) * (n - 2) << endl;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  t = 1;
  while (t--) solve();
  return 0;
}
