#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const long long int inf = 1e18;
const long long int ninf = -1e18;
const long long int mod = 1000000007;
const long long int MOD = 998244353;
template <typename T>
bool asc(pair<T, T> &a, pair<T, T> &b) {
  if (a.first == b.first) {
    return a.second < b.second;
  }
  return a.first < b.first;
}
template <typename T>
bool desc(pair<T, T> &a, pair<T, T> &b) {
  if (a.first == b.first) {
    return a.second > b.second;
  }
  return a.first > b.first;
}
template <typename T>
T power(T a, T b) {
  if (b == 0) return 1;
  if (b == 1)
    return a;
  else {
    T res = (power(a, b / 2));
    if (b % 2) {
      return (res * res * a);
    } else {
      return res * res;
    }
  }
}
template <typename T>
T power(T a, T b, T modulo) {
  if (b == 0) return 1;
  if (b == 1)
    return a;
  else {
    T res = (power(a, b / 2, modulo) % modulo);
    if (b % 2) {
      return ((((res % modulo) * (res % modulo)) % modulo) * (a % modulo)) %
             modulo;
    } else {
      return ((res % modulo) * (res % modulo)) % modulo;
    }
  }
}
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <typename T>
T lcm(T p, T q) {
  return (p * q) / gcd<T>(p, q);
}
template <typename T>
void primefactorise(T n, vector<T> &vec) {
  while (n % 2 == 0) {
    vec.emplace_back(2);
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      vec.emplace_back(i);
      n = n / i;
    }
  }
  if (n > 2) {
    vec.emplace_back(n);
  }
}
template <typename T>
void all_factor(T n, vector<T> &vec) {
  for (auto i = 1; i <= sqrt(n); ++i) {
    if (n % i == 0) {
      vec.emplace_back(i);
      if (i != (n / i)) {
        vec.emplace_back(n / i);
      }
    }
  }
}
long long mulmod(long long a, long long b, long long c) {
  if (b == 0) {
    return 0;
  }
  long long s = mulmod(a, b / 2, c);
  if (b % 2 == 1) {
    long long p = (a % c + 2 * (s % c)) % c;
    return p;
  } else {
    long long p = (2 * (s % c)) % c;
    return p;
  }
}
long long mod_inv(long long a) {
  return (power<long long>(a, mod - 2, mod)) % mod;
}
void factorial(long long n, vector<long long int> fact) {
  fact.resize(n + 1, 1);
  fact[0] = 1;
  fact[1] = 1;
  for (int i = 2; i <= n; ++i) {
    fact[i] = ((fact[i - 1] % mod) * (i % mod)) % mod;
  }
}
int main() {
  std::chrono::time_point<std::chrono::high_resolution_clock> start_timer,
      end_timer;
  start_timer = std::chrono::high_resolution_clock::now();
  bool show_time = false;
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n;
  cin >> n;
  if (n == 1) {
    cout << ((1)) << "\n";
    ;
  } else if (n == 2) {
    cout << ((2)) << "\n";
    ;
  } else if (n == 3) {
    cout << ((6)) << "\n";
    ;
  } else if (n % 2) {
    cout << (((n * (n - 1) * (n - 2)))) << "\n";
    ;
  } else
    cout << (((max((((n - 3) * (n - 1) * (n - 2))) /
                       (gcd<long long>(n - 1, n - 2) *
                        gcd<long long>(n - 1, n - 3) *
                        gcd<long long>(n - 3, n - 2)),
                   (((n) * (n - 1) * (n - 3))) /
                       (gcd<long long>(n - 1, n - 3) *
                        gcd<long long>(n, n - 3) * gcd<long long>(n, n - 1))))))
         << "\n";
  ;
  end_timer = std::chrono::high_resolution_clock::now();
  long long elapsed_time =
      std::chrono::duration_cast<std::chrono::milliseconds>(end_timer -
                                                            start_timer)
          .count();
  if (show_time) {
    cout << "\nElapsed Time: " << elapsed_time << "ms\n";
  }
  return 0;
}
