#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, x, y, z, i, temp, j, z1, a, b, c = 0;
  cin >> n;
  if (n == 1) {
    cout << 1;
    return 0;
  }
  if (n == 2) {
    cout << 2;
    return 0;
  }
  x = n;
  if (x % 6 == 0) x--;
  for (i = x - 1; i >= 1; i--) {
    y = i;
    a = x;
    while (a > 0) {
      temp = y % a;
      y = a;
      a = temp;
    }
    if (y == 1) {
      y = i;
      break;
    }
  }
  z1 = x * y;
  for (j = y - 1; j >= 1; j--) {
    z = j;
    b = z1;
    while (b > 0) {
      temp = z % b;
      z = b;
      b = temp;
    }
    if (z == 1) {
      z = j;
      break;
    }
  }
  cout << x * y * z;
  return 0;
}
