#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
const long long INF = 1e18;
void solve() {
  long long n;
  cin >> n;
  if (n <= 3) {
    if (n == 1) {
      cout << "1";
    } else if (n == 2) {
      cout << "2";
    }
    if (n == 3) {
      cout << "6";
    }
    return;
  }
  long long ans;
  if (n & 1) {
    ans = n * (n - 1) * (n - 2);
  } else {
    if (n % 3) {
      ans = n * (n - 1) * (n - 3);
    } else {
      ans = (n - 1) * (n - 2) * (n - 3);
    }
  }
  cout << ans;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
