import java.util.*;
import java.lang.*;
import java.io.*;
import java.text.*;

/* Name of the class has to be "Main" only if the class is public*/
public class CF236C
{
    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static class Node {

        long pp;
        long a, b;

        Node(long x, long y) {
            a = x;
            b = y;
            pp = a * b;
        }
    }
    static class Comp implements Comparator<Node> {

        public int compare(Node o1, Node o2) {
            if (o1.pp > o2.pp) {
                return 1;
            } else {
                return -1;
            }
        }
    }
    static int gcd(int x, int y)
    {
        if(y==0) return x;
        else return gcd(y,x%y);
    }
    static long lcm(int a, int b)
    {
        return (long) (a*b/gcd(a,b));
    }
    static int modInv(int a, int m)
    {
        if(gcd(a,m)!=1) return -999;
        else return (a%m+m)%m;
    }
    static boolean isPowerOfTwo (int x)
    {
        return x!=0 && ((x&(x-1)) == 0);
    }
    static boolean isprime(int x)
    {
        for(int i=2;i<=Math.sqrt(x);i++)
        {
            if(x%i==0) return false;
        }
        return true;
    }
    static boolean prime[];
    static final int INT_MAX=1000007;

    static void sieve() {
        prime=new boolean[INT_MAX];
        Arrays.fill(prime,true);
        prime[0]=prime[1]=false;
        for(int i=2;i<=Math.sqrt(INT_MAX);i++)
        {
            if(prime[i]) {
                for(int j=i*2;j<INT_MAX;j+=i)
                prime[j]=false;
            }
        }
    }
    static int f(int n)
    {
        if(n<=1) return 1;
        else return n*f(n-1);
    }
    static boolean coprime(int a,int b)
    {
        if(a<b) {
            a=a^b;
            b=b^a;
            a=a^b;
        }
        if(gcd(a,b)==1) return true;
        else return false;
    }

    static final int mod=1000000007;
    public static void main(String[] args) {
        FastReader sc=new FastReader();
        PrintWriter out=new PrintWriter(System.out);
        StringBuffer sb=new StringBuffer();
        //your code starts here
        sieve();
        int n=sc.nextInt();
        if(n<=4) {
            System.out.println(f(n)/f(n-2));
            return;
        }
        int m=n-1,p=m-1;
        while(!coprime(m,p) || !coprime(n,p)) --p;
        /* if(n%p==0 || m%p==0) {
            --p;
            while(!prime[p]) --p;
        } */
        if(p<=1) ++p;
        if(prime[n]) {
            m=n-1; p=n-2;
        }
        if(n%6==0)
        {
            --n; m=n-1;p=n-2;
        }
        // out.println(p+" "+m+" "+n);
        long res=(long)n*(long)m*(long)p;
        out.println(res);
        out.close();
    }
}

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Crash
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
	private long lcm(long a, long b) {
		return a * b / NumberTheory.gcd(a, b);
	}
	public void solve(int testNumber, InputReader in, OutputWriter out) {
		int n = in.readInt();
		if (n <= 100) {
			long ans = 0;
			for (int i = 1; i <= n; i ++)
				for (int j = i; j <= n; j ++)
					for (int k = j; k <= n; k ++) {
						ans = Math.max(ans, lcm(lcm(i, j), k));
					}
			out.printLine(ans);
			return;
		}
		if (n % 2 == 1) {
			out.printLine((long)n * (n - 1) * (n - 2));
		} else {
			long ans = (long)(n - 1) * (n - 2) * (n - 3);
			for (int i = n - 2; i >= 1; i --) {
				ans = Math.max(ans, lcm(lcm(n, n - 1), i));
			}
			out.printLine(ans);
		}
	}
}

class NumberTheory {
	private NumberTheory() {
	}

	public static long gcd(long m, long n) {
		if (m == 0) return n;
		while (n > 0) {
			long r = m % n;
			m = n;
			n = r;
		}
		return m;
	}

	}

class InputReader {
	private InputStream stream;
	private byte[] buf = new byte[1000];
	private int curChar;
	private int numChars;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	private int read() {
		if (numChars == -1)
			throw new UnknownError();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new UnknownError();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9') throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private boolean isSpaceChar(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}

	public void close() {
		writer.close();
	}
}

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        if (n < 3) {
            out.println(n);
            return;
        }
        long res = 0;
        if (n % 2 == 1) {
            res = lcm(lcm(n, n - 1), n - 2);
            out.println(res);
            return;
        }
        for (int i = Math.max(1, n - 50); i + 2 <= n; i++) {
            for (int j = i + 1; j + 1 <= n; j++) {
                for (int k = j + 1; k <= n; k++) {
                    long foo = lcm(i, j);
                    res = Math.max(res, lcm(foo, k));
                }
            }
        }
        out.println(res);
    }

    public long gcd(long a, long b) {
        while (b != 0) {
            long t = b;
            b = a % b;
            a = t;
        }
        return Math.abs(a);
    }

    public long lcm(long a, long b) {
        return Math.abs(a / gcd(a, b) * b);
    }

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.util.Scanner;

public class C146A {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();
        long ans = 0;
        if (n <= 6) {
            if (n == 1)
                ans = 1;
            if (n == 2)
                ans = 2;
            if (n == 3)
                ans = 6;
            if (n == 4)
                ans = 12;
            if (n == 5)
                ans = 60;
            if (n == 6)
                ans = 60;
        } else {
            if (n % 2 == 1)
                ans = n * (n - 1) * (n - 2);
            else {
                ans = n * (n - 1);
                for (long j = n - 2; j >= 1; --j) {
                    if (gcd(n, j) == 1 && gcd(n - 1, j) == 1) {
                        ans *= j;
                        break;
                    }
                }
                ans = Math.max(ans, (n -1) * (n -2) * (n - 3));
            }
        }
        System.out.println(ans);
    }

    private static long gcd(long a, long b) {
        return (a == 0) ? b : gcd(b % a, a);
    }
}

import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.geom.*;

import static java.lang.Math.*;

public class Solution implements Runnable {

	static final int MAGIC = 100;

	long gcd (long a, long b) {
		return b == 0 ? a : gcd (b, a % b);
	}

	long lcm (long a, long b) {
		return a / gcd (a, b) * b;
	}

	public void solve () throws Exception {
		int n = nextInt();
		long ans = 0;
		for (int a = n; a >= max (n - MAGIC, 1); a--) {
			for (int b = n; b >= max (n - MAGIC, 1); b--) {
				for (int c = n; c >= max (n - MAGIC, 1); c--) {
					long cur = lcm (a, lcm (b, c));
					ans = max (ans, cur);
				}
			}
		}
		out.println(ans);
	}

	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	private String nextToken () throws Exception {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	private int nextInt () throws Exception {
		return Integer.parseInt(nextToken());
	}

	private long nextLong () throws Exception {
		return Long.parseLong(nextToken());
	}

	private double nextDouble () throws Exception {
		return Double.parseDouble(nextToken());
	}

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve ();
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) {
		new Thread(null, new Solution(), "", 1<<26).start();
	}

}

import java.util.*;
import java.lang.*;
import java.io.*;

public class LCM {
	public static long gcd(long a,long b) {
		while(true) {
	    	a=a%b;
		  	if (a==0) return b;
		    b=b%a;
		    if (b==0) return a;
		}
    }
	public static void main (String[] args) throws java.lang.Exception {
		Scanner in=new Scanner(System.in);
		long n=in.nextInt();
		if (n>2) {
			if (gcd(n,n-2)>1) {
				if (gcd(n,n-3)>1) {
					System.out.println((n-1)*(n-2)*(n-3));
				}
				else System.out.println(n*(n-1)*(n-3));
			}
			else System.out.println(n*(n-1)*(n-2));
		}
		else System.out.println(n);
	}
}

import java.awt.Point;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class C {

    static Point end;

    public static void main(String[] Args) {
        long n = si();
        if (n == 1)
            System.out.println(1);
        else if (n == 2) {
            System.out.println(2);
        } else if (n % 2 == 1) {
            System.out.println((n * (n - 1) * (n - 2)));
        } else if (n % 3 != 0) {
            System.out.println((n * (n - 1) * (n - 3)));
        } else {
            System.out.println(((n - 1) * (n - 2) * (n - 3)));
        }

    }

    static int[] f(List<Integer> v) {
        int[] a = new int[1 + (int) 1e6];
        for (int i : v)
            a[i]++;
        return a;
    }

    static int toi(Object s) {
        return Integer.parseInt(s.toString());
    }

    // ----------------------- Library ------------------------
    static int[] dx = { 1, 0, -1, 1, -1, 1, 0, -1 }, dy = { 1, 1, 1, 0, 0, -1,
            -1, -1 };
    static Scanner scan = new Scanner(System.in);
    static int INF = 2147483647;

    // finds GCD of a and b using Euclidian algorithm
    public int GCD(int a, int b) {
        if (b == 0)
            return a;
        return GCD(b, a % b);
    }

    static List<String> toList(String[] a) {
        return Arrays.asList(a);
    }

    static String[] toArray(List<String> a) {
        String[] o = new String[a.size()];
        a.toArray(o);
        return o;
    }

    static int[] pair(int... a) {
        return a;
    }

    static int si() {
        return scan.nextInt();
    }

    static String ss() {
        return scan.next();
    }

    static int[] sai(int n) {
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++)
            a[i] = si();

        return a;
    }

    static int[] sai_(int n) {
        int[] a = new int[n + 1];
        for (int i = 1; i <= n; i++)
            a[i] = si();

        return a;
    }

    static String[] sas(int n) {
        String[] a = new String[n];
        for (int i = 0; i < a.length; i++)
            a[i] = ss();
        return a;
    }

    static Object[][] _sm1(int r, int c) {
        Object[][] a = new Object[r][c];
        for (int i = 0; i < r; i++)
            for (int j = 0; j < c; j++)
                a[i][j] = scan.next();
        return a;
    }

    static Object[][] _sm2(int r) {
        Object[][] a = new Object[r][3];
        for (int i = 0; i < r; i++)
            a[i] = new Object[] { ss(), ss(), ss() };
        return a;
    }
}

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Acm {
	public static void main(String args[]){
		BigInteger x ;
		Scanner sc= new Scanner(System.in);
		long n =sc.nextLong(); long lcm1,lcm2,lcm3 =0 ; long max =0 ; long res= 0;

		if(n<=3)System.out.println(n==3?6:n); else
		{
			for(long i = n ; i>=4 ;i-- ){

			 lcm1 =lcm(lcm(i,i-1),i-2);
			 lcm2 =lcm(lcm(i,i-1),i-3);
			 lcm3 = lcm(lcm(i-1,i-2),i-3);
			 res = Math.max(res, Math.max(lcm1, Math.max(lcm2, lcm3)));

			}

			System.out.println(res);

		}

		}

		public static long gcd(long n,long l){
			if(n==0) return l ;
			if(l==0) return n ;
			if(n>l) return gcd(n%l,l); else return gcd(n,l%n);

		}
		public static long lcm(long n,long l){

			return n*l/gcd(n,l);

		}

	}

import java.awt.Point;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class C {

    static Point end;

    public static void main(String[] Args) {

        int n = si();
        if (n == 1) {
            System.out.println(1);
            return;
        }
        if (n == 2) {
            System.out.println(2);
            return;
        }
        int b = n - 1, c = n - 2;
        long o = 0;
        int z = 3;
        String s = "";
        for (int i = n; i >= n - z; i--) {
            for (int j = n; j >= n - z; j--) {
                for (int k = n; k >= n - z; k--) {
                    int[] w = { i, j, k };
                    Arrays.sort(w);
                    String t = w[0] + "" + w[1] + "" + w[2];
                    if (!s.contains(t)) {
                        s += t;
                        if (i > 0 && j > 0 && k > 0) {
                            o = Math.max(o, S(i, j, k));
                        }
                    }
                }
            }
        }
        System.out.println(o);

    }

    static Map<Integer, int[]> map = new HashMap<Integer, int[]>();
    int[] d = new int[1 + (int) 1e6];

    static long S(int n, int b, int c) {
        int[] a1 = null;
        if (map.containsKey(n))
            a1 = map.get(n);
        else {
            a1 = f(d(n));
            map.put(n, a1);
        }

        int[] a2 = null;
        if (map.containsKey(b))
            a2 = map.get(b);
        else {
            a2 = f(d(b));
            map.put(b, a2);
        }

        int[] a3 = null;
        if (map.containsKey(a3))
            a3 = map.get(c);
        else {
            a3 = f(d(c));
            map.put(c, a3);
        }

        long x = 1;
        for (int i = 2; i < a3.length; i++) {
            long m = Math.max(a1[i], a2[i]);
            m = Math.max(a3[i], m);
            if (a1[i] > 0 || a2[i] > 0 || a3[i] > 0)
                for (int j = 0; j < m; j++) {
                    x *= (long) i;
                }
        }
        return x;
    }

    static int[] f(List<Integer> v) {
        int[] a = new int[1 + (int) 1e6];
        for (int i : v)
            a[i]++;
        return a;
    }

    static List<Integer> d(int x) {
        List<Integer> set = new ArrayList<Integer>();
        int w = x / 2;
        for (int j = 2; j <= w;) {
            if (x % j == 0) {
                x = x / j;
                set.add(j);
            } else
                j++;
        }
        if (set.size() == 0)
            set.add(x);
        return set;
    }

    static int toi(Object s) {
        return Integer.parseInt(s.toString());
    }

    // ----------------------- Library ------------------------
    static int[] dx = { 1, 0, -1, 1, -1, 1, 0, -1 }, dy = { 1, 1, 1, 0, 0, -1,
            -1, -1 };
    static Scanner scan = new Scanner(System.in);
    static int INF = 2147483647;

    // finds GCD of a and b using Euclidian algorithm
    public int GCD(int a, int b) {
        if (b == 0)
            return a;
        return GCD(b, a % b);
    }

    static List<String> toList(String[] a) {
        return Arrays.asList(a);
    }

    static String[] toArray(List<String> a) {
        String[] o = new String[a.size()];
        a.toArray(o);
        return o;
    }

    static int[] pair(int... a) {
        return a;
    }

    static int si() {
        return scan.nextInt();
    }

    static String ss() {
        return scan.next();
    }

    static int[] sai(int n) {
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++)
            a[i] = si();

        return a;
    }

    static int[] sai_(int n) {
        int[] a = new int[n + 1];
        for (int i = 1; i <= n; i++)
            a[i] = si();

        return a;
    }

    static String[] sas(int n) {
        String[] a = new String[n];
        for (int i = 0; i < a.length; i++)
            a[i] = ss();
        return a;
    }

    static Object[][] _sm1(int r, int c) {
        Object[][] a = new Object[r][c];
        for (int i = 0; i < r; i++)
            for (int j = 0; j < c; j++)
                a[i][j] = scan.next();
        return a;
    }

    static Object[][] _sm2(int r) {
        Object[][] a = new Object[r][3];
        for (int i = 0; i < r; i++)
            a[i] = new Object[] { ss(), ss(), ss() };
        return a;
    }
}

import java.awt.Point;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class C {

    static Map<Point, Integer> map = new HashMap<Point, Integer>();
    static Point end;

    public static void main(String[] Args) {

        int n = si();
        if (n == 1) {
            System.out.println(1);
            return;
        }
        if (n == 2) {
            System.out.println(2);
            return;
        }
        int b = n - 1, c = n - 2;
        long o = 0;
        int z = 3;
        String s = "";
        for (int i = n; i >= n - z; i--) {
            for (int j = n; j >= n - z; j--) {
                for (int k = n; k >= n - z; k--) {
                    int[] w = { i, j, k };
                    Arrays.sort(w);
                    String t = w[0] + "" + w[1] + "" + w[2];
                    if (!s.contains(t)) {
                        s += t;
                        if (i > 0 && j > 0 && k > 0) {
                            o = Math.max(o, S(i, j, k));
                        }
                    }
                }
            }
        }
        System.out.println(o);

    }

    int[] d = new int[1 + (int) 1e6];

    static long S(int n, int b, int c) {
        int[] a1 = f(d(n));
        int[] a2 = f(d(b));
        int[] a3 = f(d(c));
        long x = 1;
        for (int i = 2; i < a3.length; i++) {
            long m = Math.max(a1[i], a2[i]);
            m = Math.max(a3[i], m);
            if (a1[i] > 0 || a2[i] > 0 || a3[i] > 0)
                for (int j = 0; j < m; j++) {
                    x *= (long) i;
                }
        }
        return x;
    }

    static int[] f(List<Integer> v) {
        int[] a = new int[1 + (int) 1e6];
        for (int i : v)
            a[i]++;
        return a;
    }

    static List<Integer> d(int x) {
        List<Integer> set = new ArrayList<Integer>();
        int w = x / 2;
        for (int j = 2; j <= w;) {
            if (x % j == 0) {
                x = x / j;
                set.add(j);
            } else
                j++;
        }
        if (set.size() == 0)
            set.add(x);
        return set;
    }

    static int toi(Object s) {
        return Integer.parseInt(s.toString());
    }

    // ----------------------- Library ------------------------
    static int[] dx = { 1, 0, -1, 1, -1, 1, 0, -1 }, dy = { 1, 1, 1, 0, 0, -1,
            -1, -1 };
    static Scanner scan = new Scanner(System.in);
    static int INF = 2147483647;

    // finds GCD of a and b using Euclidian algorithm
    public int GCD(int a, int b) {
        if (b == 0)
            return a;
        return GCD(b, a % b);
    }

    static List<String> toList(String[] a) {
        return Arrays.asList(a);
    }

    static String[] toArray(List<String> a) {
        String[] o = new String[a.size()];
        a.toArray(o);
        return o;
    }

    static int[] pair(int... a) {
        return a;
    }

    static int si() {
        return scan.nextInt();
    }

    static String ss() {
        return scan.next();
    }

    static int[] sai(int n) {
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++)
            a[i] = si();

        return a;
    }

    static int[] sai_(int n) {
        int[] a = new int[n + 1];
        for (int i = 1; i <= n; i++)
            a[i] = si();

        return a;
    }

    static String[] sas(int n) {
        String[] a = new String[n];
        for (int i = 0; i < a.length; i++)
            a[i] = ss();
        return a;
    }

    static Object[][] _sm1(int r, int c) {
        Object[][] a = new Object[r][c];
        for (int i = 0; i < r; i++)
            for (int j = 0; j < c; j++)
                a[i][j] = scan.next();
        return a;
    }

    static Object[][] _sm2(int r) {
        Object[][] a = new Object[r][3];
        for (int i = 0; i < r; i++)
            a[i] = new Object[] { ss(), ss(), ss() };
        return a;
    }
}

import java.io.*;
import java.lang.Math;
import java.util.*;

public class Main
{
	public BufferedReader in;
	public PrintStream out;

	public boolean log_enabled = true;

	public void test()
	{
		long n = readLong();

		if (n<3)
		{
			out.println(n);
			return;
		}

		if (n==3)
		{
			out.println(6);
			return;
		}

		if (n % 2 == 1)
		{
			out.println(n*(n-1)*(n-2));
			return;
		}

		if (n % 3 != 0)
		{
			out.println(n*(n-1)*(n-3));
			return;
		}

		out.println((n-1)*(n-2)*(n-3));
		return;
	}

	public void run()
	{
		try
		{
			in = new BufferedReader(new InputStreamReader(System.in));
			out = System.out;

			//in = new BufferedReader(new FileReader("in.txt"));
			//out = new PrintStream(new File("out.txt"));

		}
		catch (Exception e)
		{
			return;
		}

		//while (true)
		{
			//int t = readInt(); for (int i=0; i<t; i++)
			{
				test();
			}
		}
	}

	public static void main(String args[])
	{
		new Main().run();
	}

	private StringTokenizer tokenizer = null;

	public int readInt()
	{
        return Integer.parseInt(readToken());
    }

    public long readLong()
	{
        return Long.parseLong(readToken());
    }

    public double readDouble()
	{
        return Double.parseDouble(readToken());
    }

	public String readLn()
	{
		try
		{
			String s;
			while ((s = in.readLine()).length()==0);
			return s;
		}
		catch (Exception e)
		{
			return "";
		}
	}

    public String readToken()
	{
		try
		{
			while (tokenizer == null || !tokenizer.hasMoreTokens())
			{
				tokenizer = new StringTokenizer(in.readLine());
			}
			return tokenizer.nextToken();
		}
		catch (Exception e)
		{
			return "";
		}
    }

	public int[] readIntArray(int n)
	{
		int[] x = new int[n];
		readIntArray(x, n);
		return x;
	}

	public void readIntArray(int[] x, int n)
	{
		for (int i=0; i<n; i++)
		{
			x[i] = readInt();
		}
	}

	public void logWrite(String format, Object... args)
	{
		if (!log_enabled)
		{
			return;
		}

		out.printf(format, args);
	}
}

import java.io.*;
import java.util.*;

public class A {

	public static void main(String[] args)throws IOException
	{
		long start=System.nanoTime();
		BufferedReader ob = new BufferedReader(new InputStreamReader(System.in));
		StringBuffer sb = new StringBuffer();

		int n=Integer.parseInt(ob.readLine());
		long etf=phi(n);

		int n1=1,n2=1,n3=1;
		long max=0;
//		System.out.println("etf = "+etf);
		if(etf<2)
		{
			n1=n;
			n2=n-1>0?n-1:1;
			n3=n-2>0?n-2:1;
		}
		else
		{
			if(n%2!=0)
			{
				n1=n;
				n2=n-1>0?n-1:1;
				n3=n-2>0?n-2:1;
			}
			else
			{
				int a=n-1;
				int b=n-(1+1)>0?(n-(1+1)):1;
				int c=n-(1+2)>0?(n-(1+2)):1;
				long prod1=(long)a*(long)b*(long)c;
				if(prod1>max)
				{
					max=prod1;
					n1=a;
					n2=b;
					n3=c;
				}
				if(n%3!=0)
				{	int a1=n;
					int b1=n-1>0?(n-1):1;
					int c1=n-3>0?(n-3):1;
					long prod2=(long)a1*(long)b1*(long)c1;
//		 			System.out.println("prd2 = "+prod2);
					if(prod2>max)
					{
						max=prod2;
						n1=a1;
						n2=b1;
						n3=c1;
					}
				}
			}
		}
//		System.out.println(n1+" "+n2+" "+n3);
		System.out.println((long)n1*(long)n2*(long)n3);

	}
	static long phi(int n) {
		long res = n;
		for (int i = 2; i < Math.sqrt(n); i++) {
			if (n % i == 0) {
				res *= (i - 1);
				res /= i;
				while (n % i == 0) {
					n /= i;
				}
			}
		}
		if (n > 1) {
			res *= (n - 1);
			res /= n;
		}

		return res;
	}
	static boolean isCoprime(int a,int b)
	{
		if(gcd(a,b)==1)
			return true;
		return false;
	}
	public static int gcd(int a, int b) {
		if (a == 0)
			return b;

		return gcd(b % a, a);
	}
}

import java.io.*;
import java.util.*;
import java.awt.*;

public class Main {
	BufferedReader in;
	PrintStream out;
	StringTokenizer tok;
	Scanner sc;
	public Main() throws NumberFormatException, IOException {
		//sc = new Scanner(System.in);
		//sc = new Scanner(new FileReader("in.txt"));
		in = new BufferedReader(new InputStreamReader(System.in));
                //in = new BufferedReader(new FileReader("in.txt"));
		out = System.out;
		run();
        }

      void run() throws NumberFormatException, IOException {
      long n = nextLong();
      int h = (int)n;

      if(n % 2 == 1 && n >= 3)
      {
        out.println(n*(n-1)*(n-2));
      }
      else if(n == 2)out.println(2);
      else if(n == 1)out.println(1);
      else
      {
        long resp = (n*(n-1)*(n-2))/2;
        int l = (h-2)/2;
        for(int i = l; i < (h-2); i++)
            if(gcd(i,n) == 1 && gcd(i,n-1) == 1)resp = Math.max(n*(n-1)*i, resp);
        out.println(Math.max((n-1)*(n-2)*(n-3), resp));

      }
    }

      long gcd ( long a, long b )  {
	if  ( b == 0 )
		return a ;
	else
		return gcd ( b, a % b ) ;
}

        String nextToken() throws IOException
	{
		String line = "";
		while(tok == null || !tok.hasMoreTokens()) {
			if((line = in.readLine()) != null)
				tok = new StringTokenizer(line);
			else
				return null;
		}
		return tok.nextToken();
	}
	int nextInt() throws NumberFormatException, IOException
	{
		return Integer.parseInt(nextToken());
	}
	long nextLong() throws NumberFormatException, IOException
	{
		return Long.parseLong(nextToken());
	}
	double nextDouble() throws NumberFormatException, IOException
	{
		return Double.parseDouble(nextToken());
	}

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		new Main();
    }
}

import java.io.*;
import java.lang.*;
import java.util.*;

public class code
{
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        long nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

	public static void main(String args[])throws IOException
	{
		FastReader scn = new FastReader();

		long n = scn.nextLong();
		long ans;

		if(n==1)
		{
			ans = 1;
		}
		else if(n==2)
		{
			ans = 2;
		}
		else if(n%2==1)
		{
			ans = n * ( n - 1) * (n-2);
		}
		else
		{
			ans = (n - 1)*(n - 2)*(n - 3);

			for(long i = n; i >= ((n - 2)*(n - 3)/n); i--)
			{
				long temp = n * (n - 1) * Math.min(i/gcd(i, n), i/gcd(i, n-1));
				if(temp > ans)
					ans = temp;
			}
		}
		System.out.println(ans);
	}

	public static long gcd(long a, long b)
	{
		if(a==0)
			return b;
		if(b==0)
			return a;

		if(a < b)
		{
			return gcd(a, b%a);
		}
		else
		{
			return gcd(b, a%b);
		}
	}
}

class Node
{
	long x, y;
	boolean visited;
	ArrayList<Node> neighbors;
	public Node()
	{
		neighbors = new ArrayList<Node>();
	}
}

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.SortedSet;
import java.util.TreeSet;

/**
 * Created by rakshit on 9/2/17.
 * Java is Love , 4 Forces.. :)
 */
public class LCM {

    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
    public static void main(String args[]) throws IOException
    {
        OutputStream outputstream=System.out;
        Reader in=new Reader();
        PrintWriter out=new PrintWriter (outputstream);
        Task solver=new Task();
        solver.solve(in,out);
        in.close();
    }

    static class Task
    {
        public final int k=100000;
        public void solve(Reader in , PrintWriter out) throws IOException
        {
            long n=in.nextLong();
            if(n>2) {
                if (n % 2 != 0) {
                    out.println(n * (n - 1) * (n - 2));
                } else {
                    long c=n*(n-1);
                    SortedSet<Long>check=new TreeSet<>();

                    for(long i=n;i>=1;i--)
                    {
                        check.add(lcm(c,i));
                    }

                    n--;
                    long ans=max(check.last(),n*(n-2)*(n-1));
                    out.println(ans);
                }
            }

            else if (n==1)
            {
                out.println(1);
            }
            else if (n==2)
            {
                out.println(2);
            }
            out.flush();
        }

        public static long max(long a,long b)
        {
            if(a>b)
            {
                return a;
            }
            else
            {
                return b;
            }
        }

        private static long gcd(long a,long b)
        {
            if(a==0)
                return b;
            else
                return gcd(b%a,a);
        }

        private static long lcm(long a, long b)
        {
            return (a*b)/gcd(a,b);
        }

        private boolean prime(int n)
        {
            if(n==1 || (n%2==0 && n!=2))
                return false;
            else if(n==2 || n==3)
            {
                return true;
            }
            else
            {
                int res=0;
                for(int i=3;i<=(int)Math.sqrt(n) ;i+=2)
                {
                    if(n%i==0)
                    {
                        res++;
                        break;
                    }
                }

                if(res>0)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {

	public void solve() throws IOException {
		long n = nextLong();
		if (n > 2) {
			long a, b, c;
			if (n % 2 == 0) {
				a = n - 1;
				b = n - 3;
				if (b % 3 == 0) {
					c = n - 2;
				} else {
					c = n;
				}
			} else {
				a = n;
				b = n - 2;
				c = n - 1;
			}
			out.println(NOK(a, NOK(b, c)));
		} else {
			out.println(n);
		}
	}

	long NOK(long a, long b) {
		long ans = a * b;
		while (a != 0) {
			if (a < b) {
				long t = b;
				b = a;
				a = t;
			}
			a %= b;
		}
		return (ans / b);
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null) {
				return "-1";
			}
			st = new StringTokenizer(s);
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble((nextToken()));
	}

	char nextChar() throws IOException {
		return (char) br.read();
	}

	void run() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(new OutputStreamWriter(System.out));
		solve();
		br.close();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		Locale.setDefault(Locale.US);
		new Main().run();
	}
}

import java.util.Scanner;

public class Main {

    public static long gcd_binary(long a, long b)
    {   a=Math.abs(a); b=Math.abs(b);
       if (a==b) return a;
       else if (a==0) return b;
       else if (b==0||a==1) return a;
       else if (b==1) return b;
       else if (a%2==0&&b%2==0) return 2*gcd_binary(a/2,b/2);
       else if (a%2==0&&b%2!=0) return gcd_binary(a/2,b);
       else if (a%2!=0&&b%2==0) return gcd_binary(b/2, a);
       else if (a<b) return gcd_binary((b-a)/2, a);
       else return gcd_binary((a-b)/2, b);
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long n;
        n=sc.nextLong();

        if (n<3) System.out.println(n);
        //else if (n==2) System.out.println(2);
        else if (n%2!=0) System.out.println(n*(n-1)/gcd_binary(n,(n-1))*(n-2)/gcd_binary(n*(n-1)/gcd_binary(n,(n-1)),(n-2)));
        else if (n%3!=0)System.out.println(n*(n-1)/gcd_binary(n,(n-1))*(n-3)/gcd_binary(n*(n-1)/gcd_binary(n,(n-1)),(n-3)));
        else System.out.println((n-1)*(n-2)/gcd_binary((n-1),(n-2))*(n-3)/gcd_binary((n-1)*(n-2)/gcd_binary((n-1),(n-2)),(n-3)));
    }
}

import java.util.*;
import java.io.*;
import java.math.*;
public class a{
	static long gcd(long a,long b){
		if(b==0)return a;
		return gcd(b,a%b);
	}
	static long lcm(long a,long b){
		return (a*b)/gcd(a,b);
	}
	public static void main( String [] args) throws IOException{
		FastScanner sc=new FastScanner();
		long n=sc.nextLong();
		if(n<3){
			System.out.println(n);
			return;
		}
		if(n%2==1){
			long ans=n*(n-1)*(n-2);
			System.out.println(ans);
		}
		else{
			long max=0;
			for(long i=(Math.max(1,n-3));i<=n;i++){
				for(long j=i+1;j<=n;j++){
					for(long k=j+1;k<=n;k++){
						long ans=lcm(i,j);
						ans=lcm(ans,k);
						max=Math.max(max,ans);
					}
				}
			}

			System.out.println(max);

		}
	}
}

class FastScanner{
	 private int BUFFER_SIZE = 1 << 16;

	private  DataInputStream din;

	private  byte[] buffer;

	private int bufferPointer, bytesRead;

	public FastScanner() {
		din = new DataInputStream(System.in);
		buffer = new byte[BUFFER_SIZE];
		bufferPointer = bytesRead = 0;
	}

	public FastScanner( String file_name) throws IOException {
		din = new DataInputStream(new FileInputStream(file_name));
		buffer = new byte[BUFFER_SIZE];
		bufferPointer = bytesRead = 0;
    }

	public String readLine() throws IOException {
		 byte[] buf = new byte[64];
		int cnt = 0, c;
		while ((c = read()) != -1) {
			if (c == '\n')
				break;
			buf[cnt++] = (byte) c;
		}
		return new String(buf, 0, cnt);
	}

    public String next() throws IOException{

		byte c = read();
		while(Character.isWhitespace(c)){
			c = read();
		}

		 StringBuilder builder = new StringBuilder();
		builder.append((char)c);
		c = read();
		while(!Character.isWhitespace(c)){
			builder.append((char)c);
			c = read();
		}

		return builder.toString();
	}

	public int nextInt() throws IOException {
		int ret = 0;
		byte c = read();
		while (c <= ' ')
			c = read();
		 boolean neg = (c == '-');
		if (neg)
			c = read();
		do {
			ret = ret * 10 + c - '0';
		} while ((c = read()) >= '0' && c <= '9');

		if (neg)
			return -ret;
		return ret;
	}

	public int[] nextIntArray( int n) throws IOException {
		 int arr[] = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = nextInt();
		}
		return arr;
	}

	public long nextLong() throws IOException {
		long ret = 0;
		byte c = read();
		while (c <= ' ')
			c = read();
		 boolean neg = (c == '-');
		if (neg)
			c = read();
		do {
			ret = ret * 10 + c - '0';
		} while ((c = read()) >= '0' && c <= '9');
		if (neg)
			return -ret;
		return ret;
	}

	public long[] nextLongArray( int n) throws IOException {
		 long arr[] = new long[n];
		for(int i = 0; i < n; i++){
			arr[i] = nextLong();
		}
		return arr;
	}

	public char nextChar() throws IOException{
		byte c = read();
		while(Character.isWhitespace(c)){
			c = read();
		}
		return (char) c;
	}

	public double nextDouble() throws IOException {
		double ret = 0, div = 1;
		byte c = read();
		while (c <= ' ')
			c = read();
		 boolean neg = (c == '-');
		if (neg)
			c = read();

		do {
			ret = ret * 10 + c - '0';
		} while ((c = read()) >= '0' && c <= '9');

		if (c == '.') {
			while ((c = read()) >= '0' && c <= '9') {
				ret += (c - '0') / (div *= 10);
			}
		}

		if (neg)
			return -ret;
		return ret;
    }

	public double[] nextDoubleArray( int n) throws IOException {
		 double arr[] = new double[n];
		for(int i = 0; i < n; i++){
			arr[i] = nextDouble();
		}
		return arr;
	}

	private void fillBuffer() throws IOException {
		bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
		if (bytesRead == -1)
			buffer[0] = -1;
	}

	private byte read() throws IOException {
		if (bufferPointer == bytesRead)
			fillBuffer();
		return buffer[bufferPointer++];
	}

	public void close() throws IOException {
		if (din == null)
			return;
		din.close();
	}

}

import java.util.*;
import java.io.*;
import java.math.*;
public class a{
	static long gcd(long a,long b){
		if(b==0)return a;
		return gcd(b,a%b);
	}
	static long lcm(long a,long b){
		return (a*b)/gcd(a,b);
	}
	public static void main( String [] args) throws IOException{
		FastScanner sc=new FastScanner();
		long n=sc.nextLong();
		if(n<3){
			System.out.println(n);
			return;
		}
		if(n%2==1){
			long ans=n*(n-1)*(n-2);
			System.out.println(ans);
		}
		else{
			long max=0;
			for(long i=(Math.max(1,n-5));i<=n;i++){
				for(long j=i+1;j<=n;j++){
					for(long k=j+1;k<=n;k++){
						long ans=lcm(i,j);
						ans=lcm(ans,k);
						max=Math.max(max,ans);
					}
				}
			}

			System.out.println(max);

		}
	}
}

class FastScanner{
	 private int BUFFER_SIZE = 1 << 16;

	private  DataInputStream din;

	private  byte[] buffer;

	private int bufferPointer, bytesRead;

	public FastScanner() {
		din = new DataInputStream(System.in);
		buffer = new byte[BUFFER_SIZE];
		bufferPointer = bytesRead = 0;
	}

	public FastScanner( String file_name) throws IOException {
		din = new DataInputStream(new FileInputStream(file_name));
		buffer = new byte[BUFFER_SIZE];
		bufferPointer = bytesRead = 0;
    }

	public String readLine() throws IOException {
		 byte[] buf = new byte[64];
		int cnt = 0, c;
		while ((c = read()) != -1) {
			if (c == '\n')
				break;
			buf[cnt++] = (byte) c;
		}
		return new String(buf, 0, cnt);
	}

    public String next() throws IOException{

		byte c = read();
		while(Character.isWhitespace(c)){
			c = read();
		}

		 StringBuilder builder = new StringBuilder();
		builder.append((char)c);
		c = read();
		while(!Character.isWhitespace(c)){
			builder.append((char)c);
			c = read();
		}

		return builder.toString();
	}

	public int nextInt() throws IOException {
		int ret = 0;
		byte c = read();
		while (c <= ' ')
			c = read();
		 boolean neg = (c == '-');
		if (neg)
			c = read();
		do {
			ret = ret * 10 + c - '0';
		} while ((c = read()) >= '0' && c <= '9');

		if (neg)
			return -ret;
		return ret;
	}

	public int[] nextIntArray( int n) throws IOException {
		 int arr[] = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = nextInt();
		}
		return arr;
	}

	public long nextLong() throws IOException {
		long ret = 0;
		byte c = read();
		while (c <= ' ')
			c = read();
		 boolean neg = (c == '-');
		if (neg)
			c = read();
		do {
			ret = ret * 10 + c - '0';
		} while ((c = read()) >= '0' && c <= '9');
		if (neg)
			return -ret;
		return ret;
	}

	public long[] nextLongArray( int n) throws IOException {
		 long arr[] = new long[n];
		for(int i = 0; i < n; i++){
			arr[i] = nextLong();
		}
		return arr;
	}

	public char nextChar() throws IOException{
		byte c = read();
		while(Character.isWhitespace(c)){
			c = read();
		}
		return (char) c;
	}

	public double nextDouble() throws IOException {
		double ret = 0, div = 1;
		byte c = read();
		while (c <= ' ')
			c = read();
		 boolean neg = (c == '-');
		if (neg)
			c = read();

		do {
			ret = ret * 10 + c - '0';
		} while ((c = read()) >= '0' && c <= '9');

		if (c == '.') {
			while ((c = read()) >= '0' && c <= '9') {
				ret += (c - '0') / (div *= 10);
			}
		}

		if (neg)
			return -ret;
		return ret;
    }

	public double[] nextDoubleArray( int n) throws IOException {
		 double arr[] = new double[n];
		for(int i = 0; i < n; i++){
			arr[i] = nextDouble();
		}
		return arr;
	}

	private void fillBuffer() throws IOException {
		bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
		if (bytesRead == -1)
			buffer[0] = -1;
	}

	private byte read() throws IOException {
		if (bufferPointer == bytesRead)
			fillBuffer();
		return buffer[bufferPointer++];
	}

	public void close() throws IOException {
		if (din == null)
			return;
		din.close();
	}

}

//package codeforces;

import java.io.*;
import java.math.*;
import java.util.*;

public class Codeforces implements Runnable {

	long gcd(long a, long b) {
		if (b == 0)	return a;
		else
			return gcd(b, a % b);
	}

	long lcm(long a, long b)
	{
		return a / gcd(a, b) * b;
	}

	public void solve() throws IOException {
		long n = nextInt();

		long answer = 0;

		for (long a = Math.max(n - 50, 1); a <= n; ++a)
			for (long b = a; b <= n; ++b)
				for (long c = b; c <= n; ++c)
					answer = Math.max(answer, lcm(lcm(a, b), c));

		writer.println(answer);
	}

	public static void main(String[] args) {
		new Codeforces().run();
	}
	PrintWriter writer;
	BufferedReader reader;
	StringTokenizer tokens;

	public void run() {

		try {
			writer = new PrintWriter(System.out);
			reader = new BufferedReader(new InputStreamReader(System.in));
			solve();
			reader.close();
			writer.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(-1);
		}

	}

	public String nextToken() throws IOException {
		while (tokens == null || !tokens.hasMoreTokens()) {
			tokens = new StringTokenizer(reader.readLine());
		}
		return tokens.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	public BigInteger nextBigInteger() throws IOException {
		return new BigInteger(nextToken());
	}
}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class magic2 {
	public static void main(String[] args) throws Exception {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		long ans = 0;
		for (long a = N; a >= Math.max(1, N - 100); a--) {
			for (long b = N; b >= Math.max(1, N - 100); b--) {
				long ab = LCM(a,b);
				if(ab!=a*b)continue;
				for (long c = N; c >= Math.max(1, N - 100); c--) {
					if (LCM(ab, c) == a * b * c) {
						// System.out.println(a*b*c);
						ans = Math.max(a * b * c, ans);
					}
				}
			}
		}
		out.println(ans);
		out.close();

	}

	private static long LCM(long a, long b) {
		return a * b / GCD(a, b);
	}

	private static long GCD(long a, long b) {
		if (b == 0)
			return a;
		return GCD(b, a % b);
	}

	private static long s(long x) {
		long ans = 0;
		while (x != 0) {
			ans += x % 10;
			x /= 10;
		}
		return ans;
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream in) throws Exception {
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer(br.readLine().trim());
		}

		public int numTokens() throws Exception {
			if (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine().trim());
				return numTokens();
			}
			return st.countTokens();
		}

		public boolean hasNext() throws Exception {
			if (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine().trim());
				return hasNext();
			}
			return true;
		}

		public String next() throws Exception {
			if (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine().trim());
				return next();
			}
			return st.nextToken();
		}

		public double nextDouble() throws Exception {
			return Double.parseDouble(next());
		}

		public float nextFloat() throws Exception {
			return Float.parseFloat(next());
		}

		public long nextLong() throws Exception {
			return Long.parseLong(next());
		}

		public int nextInt() throws Exception {
			return Integer.parseInt(next());
		}

		public String nextLine() throws Exception {
			return br.readLine();
		}
	}

}

import java.util.*;
import java.io.*;
public class LCMChallenge
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();

		if(n < 3)
		{
			System.out.println(n);
		}
		else if(n % 2 == 1)
		{
			System.out.println((long)n * (n - 1) * (n - 2));
		}
		else
		{
			if(n % 3 != 0)
			{
				System.out.println((long)n * (n - 1) * (n - 3));
			}
			else
			{
				System.out.println((long)(n - 1) * (n - 2) * (n - 3));
			}
		}
	}
}

import java.util.Scanner;

public class A235 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long a = in.nextLong();
		if (a % 2 == 0) {
			long result = cal(a);
			result = Math.max(result, cal(a + 1));
			result = Math.max(result, cal2(a));
			System.out.println(Math.max(result, a));
		}

		else {
			long result = (a - 1) * (a - 2) * (a - 0);
			System.out.println(Math.max(result, a));
		}
	}

	static long cal(long a) {
		long result = (a - 1) * (a - 2);
		result /= gcd(a - 1, a - 2);
		long gcd = gcd(result, a - 3);
		result *= (a - 3);
		result /= gcd;
		return result;
	}

	static long cal2(long a) {
		long result = (a) * (a - 1);
		result /= gcd(a - 1, a);
		long gcd = gcd(result, a - 3);
		result *= (a - 3);
		result /= gcd;
		return result;
	}

	private static long gcd(long l, long i) {
		if (l == 0 || i == 0) {
			return 1;
		}
		if (l % i == 0) {
			return i;
		}
		return gcd(i, l % i);
	}
}

import java.io.*;
import java.util.*;

public class Template implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            String filename = "";
            if (filename.isEmpty()) {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                in = new BufferedReader(new FileReader(filename + ".in"));
                out = new PrintWriter(filename + ".out");
            }
        }
    }

    String readString() {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine(), " :");
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() {
        return Integer.parseInt(readString());
    }

    int[] readIntArray(int size) {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long readLong() {
        return Long.parseLong(readString());
    }

    double readDouble() {
        return Double.parseDouble(readString());
    }

    <T> List<T>[] createGraphList(int size) {
        List<T>[] list = new List[size];
        for (int i = 0; i < size; i++) {
            list[i] = new ArrayList<>();
        }
        return list;
    }

    class Graph {
        int[][] graph;
        List<Integer>[] temp;
        int n;

        Graph(int n) {
            this.n = n;
            graph = new int[n][];
            temp = createGraphList(n);
        }

        void add(int x, int y) {
            temp[x].add(y);
            temp[y].add(x);
        }

        void addDir(int x, int y) {
            temp[x].add(y);
        }

        void build() {
            for (int i = 0; i < n; i++) {
                graph[i] = new int[temp[i].size()];
                for (int j = 0; j < temp[i].size(); j++) graph[i][j] = temp[i].get(j);
            }
        }

        void buildWithUniq() {
            for (int i = 0; i < n; i++) {
                HashSet<Integer> uniqSet = new HashSet<>();
                uniqSet.addAll(temp[i]);
                graph[i] = new int[uniqSet.size()];
                int index = 0;
                for (int x : uniqSet) {
                    graph[i][index++] = x;
                }
            }
        }
    }

    public static void main(String[] args) {
        new Template().run();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    long memoryTotal, memoryFree;

    void memory() {
        memoryFree = Runtime.getRuntime().freeMemory();
        System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10)
                + " KB");
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            memoryTotal = Runtime.getRuntime().freeMemory();
            init();
            solve();
            out.close();
            if (System.getProperty("ONLINE_JUDGE") == null) {
                time();
                memory();
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    long gcd(long a, long b) {
        if (a == 0) return b;
        return gcd(b % a, a);
    }

    long lcm(long a, long b) {
        return a * b / gcd(a, b);
    }

    long lcm(long a, long b, long c) {
        return lcm(lcm(a, b), c);
    }

    private void solve() {
        long n = readInt();
        long l = Math.max(1, n - 150);
        long max = 1;
        for (long x = l; x <= n; x++) {
            for (long y = l; y <= n; y++) {
                for (long z = l; z <= n; z++) {
                    max = Math.max(max, lcm(x, y, z));
                }
            }
        }
        out.println(max);
    }

}

import java.io.IOException;

import java.util.StringTokenizer;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeSet;
import java.util.*;

public class  Main {

    static String s=new String();
    public static void main(String[]args)
    {

        FastReader in=new FastReader();

        int n=in.nextInt();

        if(n==1)
        System.out.println(1);
        else{
        if(n==2)
            System.out.println(2);
        else
        {
            int a=n;

            int b=n-1;

            int c=n-2;

            if(n%2>0)
            {
                System.out.println((long)a*b*c);
            }

            else
            {
                int m1=gcd(a,b);

                int m2=gcd(a,c);

                int m3=gcd(b,c);

                if(m1==1 && m2==1 && m3==1)
                {
                    System.out.println(a*b*c);
                }
                else
                {

                    a=n-1;
                    b=n-2;
                    c=n-3;

                    int a2=n;

                    int b2=n-1;

                    int c2=n-3;

                    if(gcd(a2,b2)==1 && gcd(a2,c2)==1 && gcd(b2,c2)==1 && ((long)a2*b2*c2) > ((long)a*b*c))
                        System.out.println((long)a2*b2*c2);
                    else
                    System.out.println((long)a*b*c);
                }
            }
        }
        }

    }

    public static int gcd(int a,int b)
    {
        if(b==0)
            return a;

        else
            return gcd(b,a%b);
    }

}

//method for prime numbers

/*public static boolean sieve(int n) {
    boolean[]x=new boolean[n+1];
    for(int i = 0; i <= n;++i) {
        x[i] = true;
    }
    x[0] = false;
    x[1] = false;
    for(int i = 2; i * i <= n; ++i) {
         if(x[i] == true) {
             // Mark all the multiples of i as composite numbers
             for(int j = i * i; j <= n ;j += i)
                 x[j] = false;
        }
    }

    int i=0;

    int count=0;
    while(i<x.length)
    {
        if(x[i] && n%i==0)
            count++;

        i++;
    }

    return (count==3)?true:false;*/

/* monk is birthday treat

int n=in.nextInt();

       int t=in.nextInt();

       s=new List[n];

       for(int r=0;r<s.length;r++)
       {
           s[r]=new ArrayList();
       }

       while(t-->0)
       {
           int a=in.nextInt()-1;

           int b=in.nextInt()-1;
           s[a].add(b);
       }

       long[]p=new long[n];

       for(int i=0;i<s.length;i++)
       {

          Stack<Integer>e=new Stack();
          int[]k=new int[s[i].size()];
          int j=0;
          if(!s[i].isEmpty()){

              boolean []x=new boolean[n];

           for (Integer h : s[i]) {
               int count=0;

               e.add(h);

               if(!x[h]){
               x[h]=true;
               count++;
               }
               while(!e.isEmpty())
               {
                   int u=e.pop();

                   for (Integer v : s[u]) {
                       if(!x[v])
                       {
                           x[v]=true;
                           count++;
                           e.add(v);
                       }

                   }

               }

               k[j]=count;
               j++;

           }
        Arrays.sort(k);

        int q=0;
        while(q<k.length)
        {
            if(k[q]!=0)
            {
                p[i]=k[q];
                break;
            }
            q++;
        }

          }
       }
        Arrays.sort(p);
        int y=0;
        long count2=0;
        while(y<p.length)
        {
           if(p[y]!=0)
           {
              count2=p[y];
              break;
           }

           y++;
        }
        System.out.println(count2);

*/

/*class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
}*/

class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
}

import java.util.Scanner;
public class LCMChallenge {
	public static void main(String [] args) throws Exception{
		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		if(n<3)System.out.println(n);
		else if(n==3)System.out.println(6);
		else {

			if(n%2==0){
				long a = 0;
				long b = 0;

				if(n%3!=0){
					a = (n*(n-1)*(n-3));
				}
				n--;
					b = (n*(n-1)*(n-2));

				System.out.println(Math.max(a, b));
			}
			else{
				System.out.println(n*(n-1)*(n-2));
			}
		}
	}
}

import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */

	static long  dp[][] = new long[60][60];
	static int mod = 1000000009;
	static String h;
	static char cad[] = new char[55];
	static int n,m;
	static int fila [] = {0,0,1,-1};
	static int col [] = {1,-1,0,0};
	static boolean use[] = new boolean[100];

	public static long gcd(long a,long b)
	{
		if(b==0) return a;
		return gcd(b,a%b);
	}
	public static long mcm(long a,long b)
	{
		return a*b / gcd(a,b);
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//42, ""
		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();
		long res = 0, r = 0;
		for(long i = n; i>0 && i > n-50; i--)
			for(long j=n;j>0&&j > n-50; j--)
				for(long k=n;k>0&&k>n-50;k--)
				{
					r = mcm(i, mcm(j,k));
					if(res < r) res = r;
				}
		System.out.println(res);

	}
}

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import static java.lang.Integer.min;
import static java.lang.Long.max;

public class Main {
        static FastScanner in=new FastScanner();
        static PrintWriter out=new PrintWriter(System.out);

        //Never use sorting on 1-indexed array! or be very careful about negative values and stuff
        public static void main(String[]args) {
                int n=in.nextInt();

                if(n<=2){
                        out.println(n);
                }
                //if it's odd n*(n-1)*(n-2)
                else if(n%2==1){
                        out.println((long)n*(n-1)*(n-2));
                }else{
                        long ans=(n-1)*(n-2)*(n-3);
                        //otherwise we can use n n-1 and something else
                        for (int i=1;i<=n;i++){
                                ans=max(ans, lcm(lcm(n-3,n-1),i));
                        }
                        out.println(ans);
                }
                out.close();
        }

        static long lcm(long a,long b){
                return a*b/gcd(a,b);
        }
        static long gcd(long a,long b) {
                if (a == 0) return b;
                return gcd(b%a,a);
        }
        static void printArray(long[]a,int m){
                for (int i=m;i<a.length+m;i++)out.print(a[i]+" ");
                out.println();
        }
        static void printArray(int[]a,int m){
                for (int i=m;i<a.length+m;i++)out.print(a[i]+" ");
                out.println();
        }
        static void printArray(String[]a,int m){
                for (int i=m;i<a.length+m;i++)out.print(a[i]+" ");
                out.println();
        }
        static void printArray(double[]a,int m){
                for (int i=m;i<a.length+m;i++)out.print(a[i]+" ");
                out.println();
        }
        static void printArray(boolean[]a,int m){
                for (int i=m;i<a.length+m;i++)out.print(a[i]+" ");
                out.println();
        }
        static class Pair implements Comparable<Pair>{
                int first,second;
                public Pair(int a,int b) {
                        first=a;
                        second=b;
                }
                @Override
                public int compareTo(Pair o) {
                        return first-o.first;
                }
        }
        static class FastScanner{
                BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
                StringTokenizer st=new StringTokenizer("");
                String next(){
                        while(!st.hasMoreTokens())
                                try{
                                        st=new StringTokenizer(br.readLine());
                                }catch(IOException e){
                                        e.printStackTrace();
                                }
                        return st.nextToken();
                }
                int nextInt() {
                        return Integer.parseInt(next());
                }
                int[] nextArray(int n,int m) {
                        int[] a=new int[n+m];
                        for (int i=m;i<n+m;i++)a[i]=nextInt();
                        return a;
                }
                long nextLong() {
                        return Long.parseLong(next());
                }
                double nextDouble() {
                        return Double.parseDouble(next());
                }
        }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author NMouad21
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    ALCMChallenge solver = new ALCMChallenge();
    solver.solve(1, in, out);
    out.close();
  }

  static class ALCMChallenge {

    public final void solve(int testNumber, InputReader in, PrintWriter out) {
      int n = in.nextInt();

      long ans = solve(n);
      for (int i = 0; i < 1000 && --n >= 1; i++) {
        ans = Math.max(ans, solve(n));
      }
      out.println(ans);
    }

    private final long solve(int n) {
      final long t = Math.max(1L, n * (n - 1L));
      long ans = t;
      for (int i = n - 2, j = 0; i >= 1 && j < 20; i--, j++) {
        ans = Math.max(ans, LongNumberTheory.lcm(t, i));
      }
      return ans;
    }

  }

  static class LongNumberTheory {

    public static long gcd(long a, long b) {
      long tmp;
      while (b > 0) {
        tmp = a;
        a = b;
        b = tmp % b;
      }
      return a;
    }

    public static long lcm(long... a) {
      int n = a.length;
      long l = a[0];
      for (int i = 1; i < n; i++) {
        l *= a[i] / gcd(l, a[i]);
      }
      return l;
    }

  }

  static final class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[1 << 16];
    private int curChar;
    private int numChars;

    public InputReader() {
      this.stream = System.in;
    }

    public InputReader(final InputStream stream) {
      this.stream = stream;
    }

    private final int read() {
      if (this.numChars == -1) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return -1;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public final int nextInt() {
      int c;
      for (c = this.read(); isSpaceChar(c); c = this.read()) {
      }

      byte sgn = 1;
      if (c == 45) { // 45 == '-'
        sgn = -1;
        c = this.read();
      }

      int res = 0;

      while (c >= 48 && c <= 57) { // 48 == '0', 57 == '9'
        res *= 10;
        res += c - 48; // 48 == '0'
        c = this.read();
        if (isSpaceChar(c)) {
          return res * sgn;
        }
      }

      throw new InputMismatchException();
    }

    private static final boolean isSpaceChar(final int c) {
      return c == 32 || c == 10 || c == 13 || c == 9
          || c == -1; // 32 == ' ', 10 == '\n', 13 == '\r', 9 == '\t'
    }

  }
}

import java.util.*;
import java.io.*;

public class Main{
  /*
  .
  .
  .
  .
  .
  .
  .
  some constants
  .
  */
  /*
  .
  .
  .
  if any
  .
  .
  */
  public static void main(String[] args) throws IOException{
		/*
		.
		.
		.
		.
		.
		.
		*/long n=nl();
      long ans=1;
      if(n<3)
       ans=n;
      else if(n%2==0)
        ans *=(n-1)*(n-3)*(n%3==0?(n-2):n);
      else
        ans=(n*(n-1)*(n-2));
      sop(ans);
//

    /*
		.
		.
		.
		.
		.
		.
		.
		*/
	}
	/*
	temporary functions
	.
	.
	*/
	/*
	fuctions
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	.
	abcdefghijklmnopqrstuvwxyz
	.
	.
	.
	.
	.
	.
	*/
	static int modulo(int j,int m){
		if(j<0)
			return m+j;
		  if(j>=m)
			return j-m;

			return j;
	}
	static final int mod=1000000007;
	static final double eps=1e-8;
	static final long inf=100000000000000000L;
	static final boolean debug=true;
	static Reader in=new Reader();
	static StringBuilder ansa=new StringBuilder();
	static long powm(long a,long b,long m){
		long an=1;
		long c=a;
		while(b>0){
			if(b%2==1)
				an=(an*c)%m;
			c=(c*c)%m;
			b>>=1;
		}
		return an;
	}
	static Random rn=new Random();
	static void sop(Object a){System.out.println(a);}
	static int ni(){return in.nextInt();}
	static int[] nia(int n){int a[]=new int[n];for(int i=0;i<n;i++)a[i]=ni();return a;}
	static long nl(){return in.nextLong();}
	static long[] nla(int n){long a[]=new long[n];for(int i=0; i<n; i++)a[i]=nl();return a;}
	static String ns(){return in.next();}
	static String[] nsa(int n){String a[]=new String[n];for(int i=0; i<n; i++)a[i]=ns();return a;}
	static double nd(){return in.nextDouble();}
	static double[] nda(int n){double a[]=new double[n];for(int i=0;i<n;i++)a[i]=nd();return a;}
	static class Reader{
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public Reader(){
			reader=new BufferedReader(new InputStreamReader(System.in),32768);
			tokenizer=null;
		}
		public String next(){
			while(tokenizer==null || !tokenizer.hasMoreTokens()){
				try{
					tokenizer=new StringTokenizer(reader.readLine());
				}
				catch(IOException e){
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt(){
			return Integer.parseInt(next());
		}
		public long nextLong(){
			return Long.parseLong(next());
		}
		public double nextDouble(){
			return Double.parseDouble(next());
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.StringTokenizer;

public class A implements Runnable {

	private void solve() throws IOException {
		long n = in.nextInt();

		long from = n - 50;
		if (from < 1) {
			from = 1;
		}

		long res = 0;
		for (long a = from; a <= n; a++) {
			for (long b = from; b <= n; b++) {
				for (long c = from; c <= n; c++) {
					long v = a * b / gcd(a, b);
					v = v * c / gcd(v, c);
					if (v > res) {
						res = v;
					}
				}
			}
		}
		out.println(res);
	}

	private long gcd(long a, long b) {
		while (b > 0) {
			long c = a % b;
			a = b;
			b = c;
		}
		return a;
	}

	public static void main(String[] args) {
		new Thread(new A()).start();
	}

	public void run() {
		try {
			in = new FastScanner(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	PrintWriter out;
	FastScanner in;

	class FastScanner {

		BufferedReader reader;
		StringTokenizer st;

		public FastScanner(Reader reader) {
			this.reader = new BufferedReader(reader);
			st = null;
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}
	}

}

import java.io.*;
import java.util.*;
public class Solution{

                 public static void main(String[] args){

                      long n = longg();
                if(n<3)
			System.out.println(n);
		else if(n%2==0)
			System.out.println((n-1)*(n-3)*(n%3==0?n-2:n));
		else
			System.out.println(n*(n-1)*(n-2));

              }
                static FastReader sc=new FastReader();
                static PrintWriter out = new PrintWriter(System.out);
                static int mod=1000000007;

                static int intt(){
                       int x = sc.nextInt();
                       return(x);
                }
               static long longg(){
                          long x = sc.nextLong();
                           return(x);
                }
               static double doublee(){
                          double t = sc.nextDouble();
                           return(t);
                }
              static String str(){
                       String s = sc.next();
                         return(s);
                }
              static String strln(){

                        String s = sc.nextLine();
                           return(s);
              }
              static long pow(long a,long b){
                       long ans=1;
                      while(b>0){
                          if(b%2==1)
                              ans=(ans*a);
                              a=(a*a)%mod;
                              b=b/2;
                      }
                    return(ans);
                }
             static long GCD(long a,long b){
                           if(b%a==0)
                               return(a);
                               return(GCD(b%a,a));
              }
            static long LCM(long a,long b){
                         return ((a*b)/GCD(a,b));
               }
              static long Fermat(long a,long p){
                           long b = p-2,ans=1;
                            while(b>0){
                                 if(b%2==1)
                                      ans=(ans*a)%p;
                                       a=(a*a)%p;
                                       b=b/2;
                              }
                           return(ans);
                   }
              static void Fact(long a[],long m){
                              a[0]=1;
                           for(int i=1;i<a.length;i++)
                                   a[i]=(i*a[i-1])%m;

                      }
              static void Fact_Inv(long a[],long F[],long m){

                                 int n =a.length;
                                     a[n-1]=Fermat(F[n-1],m);
                                 for(int i=n-2;i>=0;i--)
                                        a[i]=((i+1)*a[i+1])%m;
                        }
               /*static  long d, x, y;
              static void extendedEuclid(long A, long B) {
                            if(B == 0) {
                                  d = A;
                                  x = 1;
                                  y = 0;
                              }
                           else {
                                extendedEuclid(B, A%B);
                                 long temp = x;
                                  x = y;
                                 y = temp - (A/B)*y;
                            }
                     } */
                 /*static class pair implements Comparable<pair>{
                       int x,y;
                      pair(int a,int b){
                             x=a;
                             y=b;
                       }
                     public int compareTo(pair p1)
                           { return((p1.x-p1.y)-(this.x-this.y));}

                   public boolean equals(Object obj) {
                         if (this == obj)
                                return true;
                        if (obj == null)
                                return false;
                        if (getClass() != obj.getClass())
                                return false;
                         pair other = (pair) obj;
                          if (x != other.x)
                                  return false;
                          if (y != other.y)
                                  return false;
                            return true;
                      }
                      @Override
                 public int hashCode() {
                      return(x-y);
                   }
          }   */

      static void addEdge(LinkedList<Integer> adjList[],int s,int d){
                             adjList[s].add(d);
                             adjList[d].add(s);
              }
       static int abs(char x,char y)
                   { return(Math.abs(x-y));}
        static long min(long x,long y){
                     return(Math.min(x,y));
                 }
        static long max(long a,long b){
                        return Math.max(a,b);
                  }
         static boolean correct(int n){
                          if((n&(n+1))==0)
                              return(true);
                              return(false);
                  }
           static class pair{
                        int val;
                        int l,level,bit ; // l=-1; if not any level is flipped
                        pair(int v,int L,int j,int b){
                               val = v;
                               l =L;
                               level = j;
                                bit=b;
                        }
            }
         static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.io.BufferedInputStream;
import java.math.*;
import java.math.BigInteger;
import java.util.Scanner;
import java.math.*;
public class Main {
	public static long gcd(long a,long b)
	{
		return b==0?a:gcd(b,a%b);
	}
	public static long lcm(long a,long b)
	{
		return a*b/gcd(a,b);
	}
    public static void main(String[] args)
    {
        Scanner cin = new Scanner(new BufferedInputStream(System.in));
        while(cin.hasNext())
        {
        	long a=cin.nextLong();
        	if(a<3)
        	{
        		System.out.println(a);
        		continue;
        	}
        	else if(a==3)
        	{
        		System.out.println(6);
        		continue;
        	}
        	long max=1;
        	for(long i=a;i>=a-3;i--)
        	{
        		for(long j=a;j>=a-3;j--)
        		{
        			for(long k=a;k>=a-3;k--)
        			{
        				long res=lcm(lcm(i,j),k);
        				if(res>max)
        					max=res;
        			}
        		}
        	}
        	System.out.println(max);
        }
    }
}

import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        long n=nl();
        if(n<3)
            pn(n);
        else if(n%2==1)
            pn((n-2)*(n-1)*n);

        else
        {
            long a=(n-2)*(n-1)*n/2;
            long b=0;
            if(n%3==0)
                b=(n-1)*(n-2)*(n-3);
            else
                b=(n-1)*n*(n-3);
            pn(Math.max(a,b));
        }

    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-->0) {process();}
        out.flush();out.close();
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

    import java.util.*;
    import java.io.*;

    public class Codeforces {

        public static void main(String[] args) throws IOException {
            Reader.init(System.in);
            int n = Reader.nextInt();

            if(n < 4){
                if(n == 3)
                    System.out.println("6");
                else if(n == 2)
                    System.out.println("2");
                else
                    System.out.println("1");
            }

            else if(n % 2 != 0)
                System.out.println(lcm(lcm(n, n-1), n-2));

            else {
                long max = 0;
                int to = Math.max(n-55, 2);

                for(int i = n; i >= to; i--)
                    for(int j = n; j >= to; j--)
                        for(int k = n; k >= to; k--)
                            max = Math.max(max, lcm(lcm(i, j), k));
                System.out.println(max);
            }
        }

        static long gcd(long a, long b){
            if(b == 0)
                return a;
            return gcd(b, a%b);
        }

        static long lcm(long a, long b){
            return a*b / gcd(a,b);
        }
    }

    class  Pair implements Comparable<Pair>{

        int id;
        int freq;
        int x;

        Pair(int a, int b){
            id = a;
            x = b;
        }

        @Override
        public int compareTo(Pair t) {
            int a = t.freq - freq;

            if(a == 0)
                return x - t.x;
            return a;
        }
    }

    class Reader {

        static BufferedReader reader;
        static StringTokenizer tokenizer;

        public static int pars(String x) {
            int num = 0;
            int i = 0;
            if (x.charAt(0) == '-') {
                i = 1;
            }
            for (; i < x.length(); i++) {
                num = num * 10 + (x.charAt(i) - '0');
            }

            if (x.charAt(0) == '-') {
                return -num;
            }

            return num;
        }

        static void init(InputStream input) {
            reader = new BufferedReader(
                    new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        static void init(FileReader input) {
            reader = new BufferedReader(input);
            tokenizer = new StringTokenizer("");
        }

        static String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(
                        reader.readLine());
            }
            return tokenizer.nextToken();
        }

        static int nextInt() throws IOException {
            return pars(next());
        }

        static long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        static double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }

import java.io.*;
import java.util.StringTokenizer;

public class Main {
    static void zap() throws IOException {
        int n = nextInt();
        if(n == 1 || n == 2)
        {
            out.println(n);
            return;
        }
        long a, b, c, prod1;
        if(n % 2 == 0)
        {
            if(n % 3 == 0)
            {
                a = n-1; b = n-2; c = n-3;
            }
            else
            {
                a = n; b = n-1; c = n-3;
            }
        }
        else
        {
            a = n; b = n-1; c = n-2;
        }
        out.println(a*b*c);
    }

    static BufferedReader br;
    static StringTokenizer st;
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        InputStream input = System.in;
        //InputStream input = new FileInputStream("fileIn.in");
        br = new BufferedReader(new InputStreamReader(input));
        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileOutputStream("fileOut.out"));
        zap();
        out.close();
    }

    static long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    static String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }
}

import java.util.*;
public class LCMChallenge146{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    if(n==1 || n==2)
      System.out.println(n);
    else if(n == 3)
      System.out.println("6");
    else{
      long l1=1;
      if(n%2 == 0){
        if(n%3 == 0){
          l1 = (n-1)*(n-2);
          l1 = l1*(n-3);
        }
        else
          l1 = n*(n-1)*(n-3);
      }
      else l1 = n * (n-1) * (n-2);
      System.out.println(l1);
    }
  }
  static int gcd(int a, int b){
    if (a == 0 || b == 0)
        return 0;
    if (a == b)
      return a;
    if (a > b)
      return gcd(a-b, b);
    return gcd(a, b-a);
  }
}

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class A implements Runnable {

	public void solve() throws IOException {
        long n = in.nextInt();
        long best = Math.max( lcm( n, n, n - 1, n - 2 ), lcm( n, n - 1, n - 2, n - 3 ) );
        int b = 1;
        for ( int i = 2; i < n; i ++ ) {
            if ( n % i != 0 ) {
                b = i;
                break;
            }
        }
        best = Math.max( best, lcm( n, n, n - 1, n - b ) );
        out.println( best );
	}

    private long lcm( long max, long a, long b, long c ) {
        a = Math.max( 1, Math.min( max, a ) );
        b = Math.max( 1, Math.min( max, b ) );
        c = Math.max( 1, Math.min( max, c ) );
        return lcm( a, lcm( b, c ) );
    }

    private long lcm( long a, long b ) {
        return a / gcd( a, b ) * b;
    }

    private long gcd( long a, long b ) {
        while ( b != 0 ) {
            long c = a % b;
            a = b;
            b = c;
        }
        return a;
    }

	public Scanner in;

	public PrintWriter out;

	A() throws IOException {
		in = new Scanner( System.in );
		// in = new StreamTokenizer( new InputStreamReader( System.in ) );
		out = new PrintWriter( System.out );
	}

//    int nextInt() throws IOException {
//        in.nextToken();
//        return ( int ) in.nval;
//    }

    void check( boolean f, String msg ) {
        if ( ! f ) {
            out.close();
            throw new RuntimeException( msg );
        }
    }

    void close() throws IOException {
		out.close();
	}

	public void run() {
		try {
			solve();
			close();
		} catch ( Exception e ) {
            e.printStackTrace( out );
            out.flush();
            throw new RuntimeException( e );
		}
	}

	public static void main( String[] args ) throws IOException {
		new Thread( new A() ).start();
	}
}

import java.io.*;
import java.util.*;

public class Main {
    Scanner cin = new Scanner(new BufferedInputStream(System.in));
    long n;
    long maxlcm;

    void run(){
    	n = cin.nextInt();
    	if(n == 1 || n ==2)
    		maxlcm = n;
    	else if(n >= 3){
            	if(n % 2 != 0){
    	           	maxlcm = n * (n-1) * (n - 2);
    	        }
            	else if(n%3 != 0)
            		maxlcm = n * (n - 1) * (n - 3);
            	else maxlcm = (n - 1) * (n - 2) * (n - 3);
    	}
    	System.out.println(maxlcm);
    }

	public static void main(String[] args) {
		new Main().run();

	}
}

import java.io.*;
import java.util.*;
import java.math.*;

import static java.lang.Math.*;

public class Main implements Runnable {

    long gcd(long a, long b) {
        while (b != 0) {
            a %= b;
            long temp = a;
            a = b;
            b = temp;
        }
        return a;
    }

    long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }

    void solve() throws Exception {
        long n = sc.nextLong();
        if (n <= 2) {
            out.println(n);
        } else {
            if (n % 2 == 1) {
                out.println(n * (n - 1) * (n - 2));
            } else {
                long ans = (n - 1) * (n - 2) * (n - 3);
                for (int i = 1; i <= n; i++) {
                    ans = max(ans, lcm(i, lcm(n, n - 1)));
                }
                out.println(ans);
            }
        }
    }

    BufferedReader in;
    PrintWriter out;
    FastScanner sc;

    static Throwable uncaught;

    @Override
    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            sc = new FastScanner(in);
            solve();
        } catch (Throwable t) {
            Main.uncaught = t;
        } finally {
            out.close();
        }
    }

    public static void main(String[] args) throws Throwable {
        Thread t = new Thread(null, new Main(), "", 128 * 1024 * 1024);
        t.start();
        t.join();
        if (uncaught != null) {
            throw uncaught;
        }
    }

}

class FastScanner {

    BufferedReader reader;
    StringTokenizer strTok;

    public FastScanner(BufferedReader reader) {
        this.reader = reader;
    }

    public String nextToken() throws IOException {
        while (strTok == null || !strTok.hasMoreTokens()) {
            strTok = new StringTokenizer(reader.readLine());
        }
        return strTok.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

}

import java.util.Scanner;

public class LCMChallenge {
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		if (n<=2)
		{
			System.out.println(n);
			return;
		}
		if (n%2==1)
		{
			long res = n*(n-1)*(n-2);
			System.out.println(res);
			return;
		}
		long x;
		if (n%3==0)
			x = n-2;
		else
			x = n;
		long res = x*(n-1)*(n-3);
		System.out.println(res);
	}
}

//https://codeforces.com/problemset/problem/235/A
//A. LCM Challenge
import java.util.*;
import java.io.*;
public class LCM_Challenge{
	public static void main(String[] args) throws Exception{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
		StringBuilder sb = new StringBuilder();

		int n = Integer.parseInt(br.readLine().trim());

		long ans = 0;
		if(n<3)
			ans = n;
		else if(n%2==0){
			if(n%3==0)
				ans = (long)(n-1)*(n-2)*(n-3);
			else
				ans = (long)n*(n-1)*(n-3);
		}
		else
			ans = (long)n*(n-1)*(n-2);

		pw.print(ans);
		pw.flush();
		pw.close();
	}
}

import java.io.*;
import java.util.*;
public class LCMChallenge{
	public static long gcd(long a, long b){return (b==0)?a:gcd(b, a%b);}
	public static void main(String fdjkfd[])throws IOException{
		//jkjkjk
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		long n = Integer.parseInt(br.readLine());
		if(n>=3){
		long max = -1;
		long tmp = n*n-n;
		for(long i=n-2;i>0;i--){
			max = (long)Math.max(max, tmp*i/(gcd(n,i)*gcd(n-1,i)));
			if((i&1)==1 && gcd(i, i+2)==1)
				max = (long)Math.max(max, i*(i+1)*(i+2));
		}
		System.out.println(max);
		}
		else
			System.out.println(n);
	}
}

/*
 *created by Kraken on 10-05-2020 at 20:06
 */
//package com.kraken.cf.practice;

import java.util.*;
import java.io.*;

public class A235 {

  public static void main(String[] args) {
    FastReader sc = new FastReader();
    long n = sc.nextLong();
    if (n == 1)
      System.out.println(1);
    else if (n == 2)
      System.out.println(2);
    else if (n == 3) {
      System.out.println(6);
    } else if (n == 4) {
      System.out.println(12);
    } else {
      if (n % 2 == 0) {
        long lcm = (n - 1) * (n - 3);
        System.out.println(n % 3 == 0 ? lcm * (n - 2) : lcm * n);
      } else {
        long lcm = n * (n - 1);
        System.out.println(lcm * (n - 2));
      }
    }
  }

  private static long lcm(long a, long b) {
    return a * b / gcd(a, b);
  }

  private static long gcd(long a, long b) {
    if (a == 0) return b;
    return gcd(b % a, a);
  }

  static class FastReader {

    BufferedReader br;

    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        }
        catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      }
      catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }
  }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

/**
 * 111118315581
 *
 * -3 3 2 3 2 3 2 3 -3 3 -3 3 -3 3 2 3
 *
 * @author pttrung
 */
public class C {

    public static long x, y, gcd;
    public static int Mod = 1000000007;

    public static void main(String[] args) {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File("output.txt")));
        int n = in.nextInt();
        if (n < 3) {
            out.println(n);
        } else {
            /**
             * Idea of this is simple, we always have n and n-1 gcd is 1 (obvious)
             * n and n - 2 can have gcd of 1 or 2 (if n is even ->2)
             * n and n - 3 can have gcd of 1 or 3 (if n is divided by three->3)
             * So we have only few cases to handle
             */
            if (n % 6 == 0) {
                n--;
            }
            long a, b, c;
            if (n % 2 == 0) {
                a = n;
                b = n - 1;
                c = n - 3;
            } else {
                a = n;
                b = n - 1;
                c = n - 2;
            }
//        int max = 0;
//        for(int i = 1; i <=n; i++){
//            for(int j = 1; j <= n; j++){
//                for(int k = 1; k <= n; k++){
//                    int val = ((i*j)/gcd(i,j))*k/(gcd(i*j,k));
//                    max = Math.max(max,val);
//                }
//            }
//        }
//        //out.println(a + " " + b + " " + c);
//        out.println(max);
            out.println(a * b * c);
        }
        out.close();
    }

    public static long pow(long a, long b) {
        if (b == 0) {
            return 1;
        }
        long val = pow(a, b / 2);
        if (b % 2 == 0) {
            return val * val;
        } else {
            return val * val * a;
        }
    }

    public static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static void extendEuclid(long a, long b) {
        if (b == 0) {
            x = 1;
            y = 0;
            gcd = a;
            return;
        }
        extendEuclid(b, a % b);
        long x1 = y;
        long y1 = x - (a / b) * y;
        x = x1;
        y = y1;

    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //      br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("basketball_game.txt"))));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}

import java.util.*;

public class Solution
{
       public static void main(String []args)
       {
              Scanner sc = new Scanner(System.in);
             long n = sc.nextLong();
             if(n == 1)
             System.out.println(1);

             else if(n == 2)
             System.out.println(2);

             else
             {
                    long res = 1;
                    if((n&1) == 0)
                    {
                    if(n%3 != 0)
                    res = n*(n-1)*(n-3);

                    else
                    res = (n-1)*(n-2)*(n-3);
                    }
                    else
                    res = n*(n-1)*(n-2);

                    System.out.println(res);
             }

       }
}

import java.util.*;
import java.math.*;
import java.io.*;

public class Main
	{
	public static void main(String args[]) throws IOException
		{
		BufferedReader c=new BufferedReader(new InputStreamReader(System.in));
		int N=Integer.parseInt(c.readLine());
		long max=0;
		for(int i=N-100;i<=N;i++)
			{
			for(int j=N-100;j<=N;j++)
				{
				for(int k=N-100;k<=N;k++)
					{
					if(i>=1&&j>=1&&k>=1)
						{
						long ans=lcm(lcm(i,j),k);
						if(ans>max)
							max=ans;
						}
					}
				}
			}
		System.out.println(max);
		}

	public static long gcd(long i,long j)
		{
		if(i<j)
			return gcd(j,i);
		if(j==0)
			return i;
		else
			return gcd(j,i%j);
		}
	public static long lcm(long i,long j)
		{
		return (i*j)/gcd(i,j);
		}

	}

//must declare new classes here

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.regex.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		long n=sc.nextInt();
		long ans=0;
		if(n<3){
			System.out.println(n);
		}
		else if(n==3){
			System.out.println("6");
		}
		else{
			if(n%2==0){
            	if(n%3==0)
                	ans=(n-1)*(n-2)*(n-3);
            	else
                	ans=n*(n-1)*(n-3);
        	}
        	else
            	ans=n*(n-1)*(n-2);
            System.out.println(ans);
		}

	}
}

import java.util.*;
public class LCMChallenge {
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		sc.close();
		if(n<3)
			System.out.println(n);
		else if(n%2==0)
			System.out.println((n-1)*(n-3)*(n%3==0?n-2:n));
		else
			System.out.println(n*(n-1)*(n-2));
	}
}

//package round146;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;

public class A {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	public static long gcd(long a, long b) {
		while (b > 0){
			long c = a;
			a = b;
			b = c % b;
		}
		return a;
	}

	void solve()
	{
		long n = ni();
		long max = 0;
		for(long a = Math.max(n-6,1);a <= n;a++){
			for(long b = a;b <= n;b++){
				long h = (long)a*b/gcd(a,b);
				for(long c = b;c <= n;c++){
					max = Math.max(max, h/gcd(h,c)*c);
				}
			}
		}
		out.println(max);
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception
	{
		new A().run();
	}

	public int ni()
	{
		try {
			int num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public long nl()
	{
		try {
			long num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public String ns()
	{
		try{
			int b = 0;
			StringBuilder sb = new StringBuilder();
			while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));
			if(b == -1)return "";
			sb.append((char)b);
			while(true){
				b = is.read();
				if(b == -1)return sb.toString();
				if(b == '\r' || b == '\n' || b == ' ')return sb.toString();
				sb.append((char)b);
			}
		} catch (IOException e) {
		}
		return "";
	}

	public char[] ns(int n)
	{
		char[] buf = new char[n];
		try{
			int b = 0, p = 0;
			while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));
			if(b == -1)return null;
			buf[p++] = (char)b;
			while(p < n){
				b = is.read();
				if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;
				buf[p++] = (char)b;
			}
			return Arrays.copyOf(buf, p);
		} catch (IOException e) {
		}
		return null;
	}

	double nd() { return Double.parseDouble(ns()); }
	boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

//package que_a;

import java.io.*;
import java.util.*;

public class utkarsh {

    InputStream is;
    PrintWriter out;

    long mod = (long) (1e9 + 7);
    boolean SHOW_TIME;

    int gcd(int a, int b) {
        if(b == 0)  return a;
        return gcd(b, a % b);
    }

    void solve() {
        //Enter code here utkarsh
        //SHOW_TIME = true;
        int n = ni();
        if(n < 3) {
            out.println(n);
            return;
        }
        int x = n-2;
        long ans = 1;
        while(x > 0) {
            ans = Math.max(ans, (1L * n * (n-1) * x) / (1L * gcd(x, n) * gcd(x, n-1)));
            x--;
        }
        n--;
        x = n-2;
        while(x > 0) {
            ans = Math.max(ans, (1L * n * (n-1) * x) / (1L * gcd(x, n) * gcd(x, n-1)));
            x--;
        }
        out.println(ans);
    }

    //---------- I/O Template ----------

    public static void main(String[] args) { new utkarsh().run(); }
    void run() {
        is = System.in;
        out = new PrintWriter(System.out);
        long start = System.currentTimeMillis();
        solve();
        long end = System.currentTimeMillis();
        if(SHOW_TIME) out.println("\n" + (end - start) + " ms");
        out.flush();
    }

    byte input[] = new byte[1024];
    int len = 0, ptr = 0;

    int readByte() {
        if(ptr >= len) { ptr = 0;
            try { len = is.read(input); }
            catch(IOException e) { throw new InputMismatchException(); }
            if(len <= 0) { return -1; }
        } return input[ptr++];
    }
    boolean isSpaceChar(int c) { return !( c >= 33 && c <= 126 ); }
    int skip() {
        int b = readByte();
        while(b != -1 && isSpaceChar(b)) { b = readByte(); }
        return b;
    }

    char nc() { return (char)skip(); }
    String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    String nLine() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while( !(isSpaceChar(b) && b != ' ') ) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    int ni() {
        int n = 0, b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        if(b == -1) { return -1; }  //no input
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }
    long nl() {
        long n = 0L;    int b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }

    double nd() { return Double.parseDouble(ns()); }
    float nf() { return Float.parseFloat(ns()); }
    int[] na(int n) {
        int a[] = new int[n];
        for(int i = 0; i < n; i++) { a[i] = ni(); }
        return a;
    }
    char[] ns(int n) {
        char c[] = new char[n];
        int i, b = skip();
        for(i = 0; i < n; i++) {
            if(isSpaceChar(b)) { break; }
            c[i] = (char)b; b = readByte();
        } return i == n ? c : Arrays.copyOf(c,i);
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;

public class R146C {
    public static void main (String[] args) throws java.lang.Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        long n = in.nextInt(), max = 1;
        ;
        for (long i = Math.max(1, n - 50); i <= n; i++) {
            for (long j = Math.max(1, n - 50); j <= n; j++) {
                for (long k = Math.max(1, n - 50); k <= n; k++) {
                    max = Math.max(max, lcm(i, lcm(j, k)));
                }
            }
        }
        w.println(max);

        w.close();
    }
    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    static long lcm(long a, long b) {
        return (a * b) / gcd(a, b);
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String nextString() {
            return next();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author BSRK Aditya (bsrkaditya@gmail.com)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
	public void solve(int testNumber, Scanner in, PrintWriter out) {
        long n = in.nextLong();

        if(n == 1) out.println("1");
        else if(n == 2) out.println("2");
        else if(n%2 == 1) out.println(n*(n-1)*(n-2));
        else if(n%6 == 0) out.println((n-1)*(n-2)*(n-3));
        else out.println(n*(n-1)*(n-3));
	}
}

import java.util.*;
public class MyClass
{
    public static void main(String args[])
    {
     Scanner sc=new Scanner(System.in);
     long n=sc.nextLong();
     System.out.print(lcm(n));
    }
    public static long lcm(long n)
    {
        long res=0;
        if(n<=2)
        {
            return n;
        }
        if(n%2==1)
        {
            res=n*(n-1)*(n-2);
            return res;
        }
        else
        {
            if(n%3==0)
            {
                res=(n-1)*(n-2)*(n-3);
                return res;
            }
            else
            {
                res=n*(n-1)*(n-3);
                return res;
            }
        }
    }
}

//package codeforces;

import java.io.*;
import java.util.*;

public final class LCMChallenge
{
    public static void main(String[] args)
    {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);

        Solver solver = new Solver(in, out);
        solver.solve();

        out.flush();

        in.close();
        out.close();
    }

    static class Solver
    {
        InputReader in;
        OutputWriter out;

        void solve()
        {
            long n = in.nextInt();

            if (n == 1)
                out.println(1);
            else if (n == 2)
                out.println(2);
            else if (n % 2 == 1)
                out.println(n * (n - 1) * (n - 2));
            else
                out.println(Math.max(CMath.lcm(n, n - 1, n - 3), CMath.lcm(n - 1, n - 2, n - 3)));
        }

        public Solver(InputReader in, OutputWriter out)
        {
            this.in = in;
            this.out = out;
        }

    }

    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c & 15;

                c = read();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public int[] nextIntArray(int arraySize)
        {
            int array[] = new int[arraySize];

            for (int i = 0; i < arraySize; i++)
                array[i] = nextInt();

            return array;
        }

        public long nextLong()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sign = 1;

            if (c == '-')
            {
                sign = -1;

                c = read();
            }

            long result = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                result *= 10;
                result += c & 15;

                c = read();
            } while (!isSpaceChar(c));

            return result * sign;
        }

        public long[] nextLongArray(int arraySize)
        {
            long array[] = new long[arraySize];

            for (int i = 0; i < arraySize; i++)
                array[i] = nextLong();

            return array;
        }

        public float nextFloat() // problematic
        {
            float result, div;
            byte c;

            result = 0;
            div = 1;
            c = (byte) read();

            while (c <= ' ')
                c = (byte) read();

            boolean isNegative = (c == '-');

            if (isNegative)
                c = (byte) read();

            do
            {
                result = result * 10 + c - '0';
            } while ((c = (byte) read()) >= '0' && c <= '9');

            if (c == '.')
                while ((c = (byte) read()) >= '0' && c <= '9')
                    result += (c - '0') / (div *= 10);

            if (isNegative)
                return -result;

            return result;
        }

        public double nextDouble() // not completely accurate
        {
            double ret = 0, div = 1;
            byte c = (byte) read();

            while (c <= ' ')
                c = (byte) read();

            boolean neg = (c == '-');

            if (neg)
                c = (byte) read();

            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = (byte) read()) >= '0' && c <= '9');

            if (c == '.')
                while ((c = (byte) read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);

            if (neg)
                return -ret;

            return ret;
        }

        public String next()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do
            {
                res.appendCodePoint(c);

                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String nextLine()
        {
            int c = read();

            StringBuilder result = new StringBuilder();

            do
            {
                result.appendCodePoint(c);

                c = read();
            } while (!isNewLine(c));

            return result.toString();
        }

        public boolean isNewLine(int c)
        {
            return c == '\n';
        }

        public void close()
        {
            try
            {
                stream.close();
            } catch (IOException e)
            {
                e.printStackTrace();
            }
        }

    }

    static class OutputWriter
    {
        private PrintWriter writer;

        public OutputWriter(OutputStream stream)
        {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
                    stream)));
        }

        public OutputWriter(Writer writer)
        {
            this.writer = new PrintWriter(writer);
        }

        public void println(int x)
        {
            writer.println(x);
        }

        public void print(int x)
        {
            writer.print(x);
        }

        public void println(char x)
        {
            writer.println(x);
        }

        public void print(char x)
        {
            writer.print(x);
        }

        public void println(int array[], int size)
        {
            for (int i = 0; i < size; i++)
                println(array[i]);
        }

        public void print(int array[], int size)
        {
            for (int i = 0; i < size; i++)
                print(array[i] + " ");
        }

        public void println(long x)
        {
            writer.println(x);
        }

        public void print(long x)
        {
            writer.print(x);
        }

        public void println(long array[], int size)
        {
            for (int i = 0; i < size; i++)
                println(array[i]);
        }

        public void print(long array[], int size)
        {
            for (int i = 0; i < size; i++)
                print(array[i]);
        }

        public void println(float num)
        {
            writer.println(num);
        }

        public void print(float num)
        {
            writer.print(num);
        }

        public void println(double num)
        {
            writer.println(num);
        }

        public void print(double num)
        {
            writer.print(num);
        }

        public void println(String s)
        {
            writer.println(s);
        }

        public void print(String s)
        {
            writer.print(s);
        }

        public void println()
        {
            writer.println();
        }

        public void printSpace()
        {
            writer.print(" ");
        }

        public void printf(String format, Object args)
        {
            writer.printf(format, args);
        }

        public void flush()
        {
            writer.flush();
        }

        public void close()
        {
            writer.close();
        }

    }

    static class CMath
    {
        static long gcd(long a, long b)
        {
            if (b == 0)
                return a;

            return gcd(b, a % b);
        }

        static long lcm(long... arr)
        {
            int len = arr.length;
            long lcm = arr[0];

            for (int i = 1; i < len; i++)
                lcm = (lcm * arr[i]) / gcd(lcm, arr[i]);

            return lcm;
        }

    }

}

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
/** Oct 21, 2012 **/
import java.util.InputMismatchException;
import java.util.LinkedList;

/**
 * @author DOAN Minh Quy
 * @email mquy.doan@gmail.com
 */
public class C236 {
    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        new C236().run();
    }
    void run() {
        InputScanner scanner = new InputScanner(System.in);
        PrintStream printer = new PrintStream(System.out);
        int n = scanner.nextInt();
        long answer;
        if ( n == 1 ){
            answer = 1;
        }else if ( n == 2 ){
            answer = 2;
        }else{
            if ( (n & 1) != 0 ){
                answer = (long)n * (long)(n-1) * (long)(n-2);
            }else{
                if ( n % 3 == 0 ){
                    answer = (long)(n-1) * (long)(n-2) * (long)(n-3);
                }else{
                    answer = (long)(n) * (long)(n-1) * (long)(n-3);
                }
            }
        }
        printer.println(answer);
    }
    class InputScanner{
        BufferedInputStream bis;
        byte[] buffer = new byte[1024];
        int currentChar;
        int charCount;
        public InputScanner(InputStream stream){
            bis = new BufferedInputStream(stream);
        }
        public byte read() {
            if (charCount == -1)
                throw new InputMismatchException();
            if (currentChar >= charCount) {
                currentChar = 0;
                try {
                    charCount = bis.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (charCount <= 0)
                    return -1;
            }
            return buffer[currentChar++];
        }
        public int nextInt(){
            int c = read();
            while (isSpaceChar(c)){
                c = read();
            }
            int sign = 1;
            if (c == '-') {
                sign = -1;
                c = read();
            }
            int rep = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                rep *= 10;
                rep += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return rep * sign;
        }
        public long nextLong(){
            int c = read();
            while (isSpaceChar(c)){
                c = read();
            }
            int sign = 1;
            if (c == '-') {
                sign = -1;
                c = read();
            }
            long rep = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                rep *= 10;
                rep += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return rep * (long)sign;
        }
        public String next(){
            char c = (char)read();
            while (isSpaceChar(c)){
                c = (char)read();
            }
            StringBuilder build = new StringBuilder();
            do{
                build.append(c);
                c = (char)read();
            }while(!isSpaceChar(c));
            return build.toString();
        }
        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
        public void close(){
            try {
                bis.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
}

//package codeforcesQuestions;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class cdf146a
{
	static boolean isp(int n)
	{
		for(int i=2;i<=(int)Math.sqrt(n);i++)
		{
			if(n%i==0)
				return false;
		}
		return true;
	}
	public static void main(String args[])throws Exception
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		long n=Long.parseLong(br.readLine());
		if(n==1||n==2)
		{
			System.out.println(n);
			return;
		}
		long ans=1;
		if(n%2==1)
		{
			ans=n*(n-1)*(n-2);
			System.out.println(ans);
			return;
		}
		if(n==6)
		{
			System.out.print("60");
			return;
		}
		int i;
		for(i=2;i<=2*(int)Math.sqrt(n);i++)
		{
			if(n%i!=0&&isp(i))
			break;
		}
		long ans2=(n-3)*(n-1)*(n-2);
		ans=n*(n-1)*(n-i);
		System.out.println((long)Math.max(ans2,ans));
	}
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//package codeforcespractice;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author admin
 */
public class CodeforcesPractice {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        long n=Integer.parseInt(br.readLine());
        long ans;

        if(n<3){
            ans=n;
        }
        else if(n==3){
        ans=6;
        }
        else{
        if(n%2!=0){
        ans=n*(n-1)*(n-2);
        }
        else{
                if(n%3!=0){
                ans=Math.max((n*(n-1)*(n-2))/2,n*(n-1)*(n-3));
                }
                else{
                ans=Math.max((n*(n-1)*(n-2))/2,(n-1)*(n-2)*(n-3));
                }
        }
        }
        System.out.println(ans);
    }
}

import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.reflect.*;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		Task solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

interface Task {
	public void solve(int testNumber, InputReader in, OutputWriter out);
}

class TaskA implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out) {
		long a=in.readLong(), b=in.readLong();
		out.printLine(f(a, b));
	}

	long f(long a, long b) {
		if (b==1) return a;
		if (a==1) return b;
		if (a>b) return a/b+f(a%b, b);
		return b/a+f(b%a, a);
	}

}

class TaskB implements Task {

	int[][] matrix;
	int[] array;
	boolean[] isPrime;

	public void solve(int testNumber, InputReader in, OutputWriter out) {
		int n=in.readInt(), m=in.readInt(), ret=Integer.MAX_VALUE;
		matrix=IOUtils.readIntTable(in, n, m);
		isPrime=IntegerUtils.generatePrimalityTable(1000000);
		for (int i=0; i<n; i++) {
			array=matrix[i];
			int c=0;
			for (int j=0; j<m; j++) for (int k=0; !isPrime[array[j]+k]; k++) c++;
			ret=MiscUtils.min(ret, c);
		}
		for (int i=0; i<m; i++) {
			array=new int[n];
			for (int j=0; j<n; j++) array[j]=matrix[j][i];
			int c=0;
			for (int j=0; j<n; j++) for (int k=0; !isPrime[array[j]+k]; k++) c++;
			ret=MiscUtils.min(ret, c);
		}
		out.printLine(ret);
	}

}

class TaskC implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out) {
		int n=in.readInt();
		long ret=Long.MIN_VALUE;
		for (int i=MiscUtils.max(1, n-100); i<=n; i++) for (int j=i; j<=n; j++) for (int k=j; k<=n; k++)
			ret=MiscUtils.max(ret, IntegerUtils.lcm(IntegerUtils.lcm(i, j), k));
		out.printLine(ret);
	}

}

class TaskD implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out) {
		int n=in.readInt();
		out.printLine(1L*(n/2+1)*((n+1)/2+1)%1000000009);
	}
}

class TaskE implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out) {

	}

}

class TaskF implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out) {

	}

}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(char[] array) {
		writer.print(array);
	}

	public void print(Object... objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void print(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(array[i]);
		}
	}

	public void print(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(array[i]);
		}
	}

	public void print(Collection<Integer> collection) {
		boolean first = true;
		for (int value : collection) {
			if (first)
				first = false;
			else
				writer.print(' ');
			writer.print(value);
		}
	}

	public void printLine(int[] array) {
		print(array);
		writer.println();
	}

	public void printLine(long[] array) {
		print(array);
		writer.println();
	}

	public void printLine(Collection<Integer> collection) {
		print(collection);
		writer.println();
	}

	public void printLine() {
		writer.println();
	}

	public void printLine(Object... objects) {
		print(objects);
		writer.println();
	}

	public void print(char i) {
		writer.print(i);
	}

	public void printLine(char i) {
		writer.println(i);
	}

	public void printLine(char[] array) {
		writer.println(array);
	}

	public void printFormat(String format, Object... objects) {
		writer.printf(format, objects);
	}

	public void close() {
		writer.close();
	}

	public void flush() {
		writer.flush();
	}

	public void print(long i) {
		writer.print(i);
	}

	public void printLine(long i) {
		writer.println(i);
	}

	public void print(int i) {
		writer.print(i);
	}

	public void printLine(int i) {
		writer.println(i);
	}
}

class InputReader {
	private boolean finished = false;

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int peek() {
		if (numChars == -1)
			return -1;
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				return -1;
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			if (Character.isValidCodePoint(c))
				res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	public static boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private String readLine0() {
		StringBuilder buf = new StringBuilder();
		int c = read();
		while (c != '\n' && c != -1) {
			if (c != '\r')
				buf.appendCodePoint(c);
			c = read();
		}
		return buf.toString();
	}

	public String readLine() {
		String s = readLine0();
		while (s.trim().length() == 0)
			s = readLine0();
		return s;
	}

	public String readLine(boolean ignoreEmptyLines) {
		if (ignoreEmptyLines)
			return readLine();
		else
			return readLine0();
	}

	public BigInteger readBigInteger() {
		try {
			return new BigInteger(readString());
		} catch (NumberFormatException e) {
			throw new InputMismatchException();
		}
	}

	public char readCharacter() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		return (char) c;
	}

	public double readDouble() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		double res = 0;
		while (!isSpaceChar(c) && c != '.') {
			if (c == 'e' || c == 'E')
				return res * Math.pow(10, readInt());
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		}
		if (c == '.') {
			c = read();
			double m = 1;
			while (!isSpaceChar(c)) {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				m /= 10;
				res += (c - '0') * m;
				c = read();
			}
		}
		return res * sgn;
	}

	public boolean isExhausted() {
		int value;
		while (isSpaceChar(value = peek()) && value != -1)
			read();
		return value == -1;
	}

	public String next() {
		return readString();
	}

	public SpaceCharFilter getFilter() {
		return filter;
	}

	public void setFilter(SpaceCharFilter filter) {
		this.filter = filter;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

class IOUtils {
	public static Pair<Integer, Integer> readIntPair(InputReader in) {
		int first = in.readInt();
		int second = in.readInt();
		return Pair.makePair(first, second);
	}

	public static Pair<Long, Long> readLongPair(InputReader in) {
		long first = in.readLong();
		long second = in.readLong();
		return Pair.makePair(first, second);
	}

	public static int[] readIntArray(InputReader in, int size) {
		int[] array = new int[size];
		for (int i = 0; i < size; i++)
			array[i] = in.readInt();
		return array;
	}

	public static long[] readLongArray(InputReader in, int size) {
		long[] array = new long[size];
		for (int i = 0; i < size; i++)
			array[i] = in.readLong();
		return array;
	}

	public static double[] readDoubleArray(InputReader in, int size) {
		double[] array = new double[size];
		for (int i = 0; i < size; i++)
			array[i] = in.readDouble();
		return array;
	}

	public static String[] readStringArray(InputReader in, int size) {
		String[] array = new String[size];
		for (int i = 0; i < size; i++)
			array[i] = in.readString();
		return array;
	}

	public static char[] readCharArray(InputReader in, int size) {
		char[] array = new char[size];
		for (int i = 0; i < size; i++)
			array[i] = in.readCharacter();
		return array;
	}

	public static Pair<Integer, Integer>[] readIntPairArray(InputReader in,
			int size) {
		@SuppressWarnings({ "unchecked" })
		Pair<Integer, Integer>[] result = new Pair[size];
		for (int i = 0; i < size; i++)
			result[i] = readIntPair(in);
		return result;
	}

	public static Pair<Long, Long>[] readLongPairArray(InputReader in, int size) {
		@SuppressWarnings({ "unchecked" })
		Pair<Long, Long>[] result = new Pair[size];
		for (int i = 0; i < size; i++)
			result[i] = readLongPair(in);
		return result;
	}

	public static void readIntArrays(InputReader in, int[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = in.readInt();
		}
	}

	public static void readLongArrays(InputReader in, long[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = in.readLong();
		}
	}

	public static void readDoubleArrays(InputReader in, double[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = in.readDouble();
		}
	}

	public static char[][] readTable(InputReader in, int rowCount,
			int columnCount) {
		char[][] table = new char[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readCharArray(in, columnCount);
		return table;
	}

	public static int[][] readIntTable(InputReader in, int rowCount,
			int columnCount) {
		int[][] table = new int[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readIntArray(in, columnCount);
		return table;
	}

	public static double[][] readDoubleTable(InputReader in, int rowCount,
			int columnCount) {
		double[][] table = new double[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readDoubleArray(in, columnCount);
		return table;
	}

	public static long[][] readLongTable(InputReader in, int rowCount,
			int columnCount) {
		long[][] table = new long[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readLongArray(in, columnCount);
		return table;
	}

	public static String[][] readStringTable(InputReader in, int rowCount,
			int columnCount) {
		String[][] table = new String[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readStringArray(in, columnCount);
		return table;
	}

	public static String readText(InputReader in) {
		StringBuilder result = new StringBuilder();
		while (true) {
			int character = in.read();
			if (character == '\r')
				continue;
			if (character == -1)
				break;
			result.append((char) character);
		}
		return result.toString();
	}

	public static void readStringArrays(InputReader in, String[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = in.readString();
		}
	}

	public static void printTable(OutputWriter out, char[][] table) {
		for (char[] row : table)
			out.printLine(new String(row));
	}
}

class ArrayUtils {
	private static int[] tempInt = new int[0];
	private static long[] tempLong = new long[0];

	public static Integer[] generateOrder(int size) {
		Integer[] order = new Integer[size];
		for (int i = 0; i < size; i++)
			order[i] = i;
		return order;
	}

	public static void fill(short[][] array, short value) {
		for (short[] row : array)
			Arrays.fill(row, value);
	}

	public static void fill(long[][] array, long value) {
		for (long[] row : array)
			Arrays.fill(row, value);
	}

	public static void fill(double[][] array, double value) {
		for (double[] row : array)
			Arrays.fill(row, value);
	}

	public static void fill(double[][][] array, double value) {
		for (double[][] row : array)
			fill(row, value);
	}

	public static void fill(double[][][][] array, double value) {
		for (double[][][] row : array)
			fill(row, value);
	}

	public static void fill(double[][][][][] array, double value) {
		for (double[][][][] row : array)
			fill(row, value);
	}

	public static void fill(long[][][] array, long value) {
		for (long[][] row : array)
			fill(row, value);
	}

	public static void fill(long[][][][] array, long value) {
		for (long[][][] row : array)
			fill(row, value);
	}

	public static void fill(long[][][][][] array, long value) {
		for (long[][][][] row : array)
			fill(row, value);
	}

	public static void fillColumn(long[][] array, int index, long value) {
		for (long[] row : array)
			row[index] = value;
	}

	public static void fillColumn(int[][] array, int index, int value) {
		for (int[] row : array)
			row[index] = value;
	}

	public static void fill(int[][] array, int value) {
		for (int[] row : array)
			Arrays.fill(row, value);
	}

	public static void fill(boolean[][] array, boolean value) {
		for (boolean[] row : array)
			Arrays.fill(row, value);
	}

	public static void fill(boolean[][][] array, boolean value) {
		for (boolean[][] row : array)
			fill(row, value);
	}

	public static long sumArray(int[] array) {
		long result = 0;
		for (int element : array)
			result += element;
		return result;
	}

	public static int[] range(int from, int to) {
		int[] result = new int[Math.max(from, to) - Math.min(from, to) + 1];
		int index = 0;
		if (to > from) {
			for (int i = from; i <= to; i++)
				result[index++] = i;
		} else {
			for (int i = from; i >= to; i--)
				result[index++] = i;
		}
		return result;
	}

	public static void fill(int[][][] array, int value) {
		for (int[][] subArray : array)
			fill(subArray, value);
	}

	public static void fill(short[][][] array, short value) {
		for (short[][] subArray : array)
			fill(subArray, value);
	}

	public static void fill(int[][][][] array, int value) {
		for (int[][][] subArray : array)
			fill(subArray, value);
	}

	public static void fill(short[][][][] array, short value) {
		for (short[][][] subArray : array)
			fill(subArray, value);
	}

	public static void fill(int[][][][][] array, int value) {
		for (int[][][][] subArray : array)
			fill(subArray, value);
	}

	public static void fill(short[][][][][] array, short value) {
		for (short[][][][] subArray : array)
			fill(subArray, value);
	}

	public static void fill(int[][][][][][] array, int value) {
		for (int[][][][][] subArray : array)
			fill(subArray, value);
	}

	public static void fill(short[][][][][][] array, short value) {
		for (short[][][][][] subArray : array)
			fill(subArray, value);
	}

	public static void fill(int[][][][][][][] array, int value) {
		for (int[][][][][][] subArray : array)
			fill(subArray, value);
	}

	public static void fill(short[][][][][][][] array, short value) {
		for (short[][][][][][] subArray : array)
			fill(subArray, value);
	}

	public static Integer[] order(int size, Comparator<Integer> comparator) {
		Integer[] order = generateOrder(size);
		Arrays.sort(order, comparator);
		return order;
	}

	public static <T> void fill(T[][] array, T value) {
		for (T[] row : array)
			Arrays.fill(row, value);
	}

	public static void fill(char[][] array, char value) {
		for (char[] row : array)
			Arrays.fill(row, value);
	}

	public static void fill(byte[][] array, byte value) {
		for (byte[] row : array)
			Arrays.fill(row, value);
	}

	public static void fill(byte[][][] array, byte value) {
		for (byte[][] row : array)
			fill(row, value);
	}

	public static void fill(byte[][][][] array, byte value) {
		for (byte[][][] row : array)
			fill(row, value);
	}

	public static long multiply(int[] first, int[] second) {
		long result = 0;
		for (int i = 0; i < first.length; i++)
			result += (long) first[i] * second[i];
		return result;
	}

	public static int[] createOrder(int size) {
		int[] order = new int[size];
		for (int i = 0; i < size; i++)
			order[i] = i;
		return order;
	}

	public static int[] sort(int[] array, IntComparator comparator) {
		return sort(array, 0, array.length, comparator);
	}

	public static int[] sort(int[] array, int from, int to,
			IntComparator comparator) {
		Integer[] intArray = new Integer[to - from];
		for (int i = from; i < to; i++)
			intArray[i - from] = array[i];
		Arrays.sort(intArray, comparator);
		for (int i=from; i<to; i++) array[i]=intArray[i-from];
		return array;
	}

	private static void ensureCapacityInt(int size) {
		if (tempInt.length >= size)
			return;
		size = Math.max(size, tempInt.length << 1);
		tempInt = new int[size];
	}

	private static void ensureCapacityLong(int size) {
		if (tempLong.length >= size)
			return;
		size = Math.max(size, tempLong.length << 1);
		tempLong = new long[size];
	}

	private static void sortImpl(int[] array, int from, int to, int[] temp,
			int fromTemp, int toTemp, IntComparator comparator) {
		if (to - from <= 1)
			return;
		int middle = (to - from) >> 1;
		int tempMiddle = fromTemp + middle;
		sortImpl(temp, fromTemp, tempMiddle, array, from, from + middle,
				comparator);
		sortImpl(temp, tempMiddle, toTemp, array, from + middle, to, comparator);
		int index = from;
		int index1 = fromTemp;
		int index2 = tempMiddle;
		while (index1 < tempMiddle && index2 < toTemp) {
			if (comparator.compare(temp[index1], temp[index2]) <= 0)
				array[index++] = temp[index1++];
			else
				array[index++] = temp[index2++];
		}
		if (index1 != tempMiddle)
			System.arraycopy(temp, index1, array, index, tempMiddle - index1);
		if (index2 != toTemp)
			System.arraycopy(temp, index2, array, index, toTemp - index2);
	}

	public static int[] order(final int[] array) {
		return sort(createOrder(array.length), new IntComparator() {
			public int compare(Integer first, Integer second) {
				if (array[first] < array[second])
					return -1;
				if (array[first] > array[second])
					return 1;
				return 0;
			}
		});
	}

	public static int[] order(final long[] array) {
		return sort(createOrder(array.length), new IntComparator() {
			public int compare(Integer first, Integer second) {
				if (array[first] < array[second])
					return -1;
				if (array[first] > array[second])
					return 1;
				return 0;
			}
		});
	}

	public static int[] unique(int[] array) {
		return unique(array, 0, array.length);
	}

	public static int[] unique(int[] array, int from, int to) {
		if (from == to)
			return new int[0];
		int count = 1;
		for (int i = from + 1; i < to; i++) {
			if (array[i] != array[i - 1])
				count++;
		}
		int[] result = new int[count];
		result[0] = array[from];
		int index = 1;
		for (int i = from + 1; i < to; i++) {
			if (array[i] != array[i - 1])
				result[index++] = array[i];
		}
		return result;
	}

	public static char[] unique(char[] array) {
		return unique(array, 0, array.length);
	}

	public static char[] unique(char[] array, int from, int to) {
		if (from == to)
			return new char[0];
		int count = 1;
		for (int i = from + 1; i < to; i++) {
			if (array[i] != array[i - 1])
				count++;
		}
		char[] result = new char[count];
		result[0] = array[from];
		int index = 1;
		for (int i = from + 1; i < to; i++) {
			if (array[i] != array[i - 1])
				result[index++] = array[i];
		}
		return result;
	}

	public static int maxElement(int[] array) {
		return maxElement(array, 0, array.length);
	}

	public static int maxElement(int[] array, int from, int to) {
		int result = Integer.MIN_VALUE;
		for (int i = from; i < to; i++)
			result = Math.max(result, array[i]);
		return result;
	}

	public static int[] order(final double[] array) {
		return sort(createOrder(array.length), new IntComparator() {
			public int compare(Integer first, Integer second) {
				return Double.compare(array[first], array[second]);
			}
		});
	}

	public static int[] reversePermutation(int[] permutation) {
		int[] result = new int[permutation.length];
		for (int i = 0; i < permutation.length; i++)
			result[permutation[i]] = i;
		return result;
	}

	public static void reverse(int[] array) {
		for (int i = 0, j = array.length - 1; i < j; i++, j--) {
			int temp = array[i];
			array[i] = array[j];
			array[j] = temp;
		}
	}

	public static void reverse(char[] array) {
		for (int i = 0, j = array.length - 1; i < j; i++, j--) {
			char temp = array[i];
			array[i] = array[j];
			array[j] = temp;
		}
	}

	private static long maxElement(long[] array, int from, int to) {
		long result = Long.MIN_VALUE;
		for (int i = from; i < to; i++)
			result = Math.max(result, array[i]);
		return result;
	}

	public static int minPosition(int[] array) {
		return minPosition(array, 0, array.length);
	}

	public static int maxPosition(int[] array) {
		return maxPosition(array, 0, array.length);
	}

	public static int minPosition(int[] array, int from, int to) {
		if (from >= to)
			return -1;
		int min = array[from];
		int result = from;
		for (int i = from + 1; i < to; i++) {
			if (array[i] < min) {
				min = array[i];
				result = i;
			}
		}
		return result;
	}

	public static int maxPosition(int[] array, int from, int to) {
		if (from >= to)
			return -1;
		int max = array[from];
		int result = from;
		for (int i = from + 1; i < to; i++) {
			if (array[i] > max) {
				max = array[i];
				result = i;
			}
		}
		return result;
	}

	public static int[] multiplyPermutations(int[] first, int[] second) {
		int count = first.length;
		int[] result = new int[count];
		for (int i = 0; i < count; i++) {
			result[i] = first[second[i]];
		}
		return result;
	}

	public static int[] compress(int[]... arrays) {
		int totalLength = 0;
		for (int[] array : arrays)
			totalLength += array.length;
		int[] all = new int[totalLength];
		int delta = 0;
		for (int[] array : arrays) {
			System.arraycopy(array, 0, all, delta, array.length);
			delta += array.length;
		}
		sort(all, IntComparator.DEFAULT);
		all = unique(all);
		for (int[] array : arrays) {
			for (int i = 0; i < array.length; i++)
				array[i] = Arrays.binarySearch(all, array[i]);
		}
		return all;
	}

	public static int minElement(int[] array) {
		return array[minPosition(array)];
	}

	public static long[] partialSums(int[] array) {
		long[] result = new long[array.length + 1];
		for (int i = 0; i < array.length; i++)
			result[i + 1] = result[i] + array[i];
		return result;
	}

	public static void orderBy(int[] base, int[]... arrays) {
		int[] order = ArrayUtils.order(base);
		order(order, base);
		for (int[] array : arrays)
			order(order, array);
	}

	public static void orderBy(long[] base, long[]... arrays) {
		int[] order = ArrayUtils.order(base);
		order(order, base);
		for (long[] array : arrays)
			order(order, array);
	}

	public static void order(int[] order, int[] array) {
		ensureCapacityInt(order.length);
		for (int i = 0; i < order.length; i++)
			tempInt[i] = array[order[i]];
		System.arraycopy(tempInt, 0, array, 0, array.length);
	}

	public static void order(int[] order, long[] array) {
		ensureCapacityLong(order.length);
		for (int i = 0; i < order.length; i++)
			tempLong[i] = array[order[i]];
		System.arraycopy(tempLong, 0, array, 0, array.length);
	}

	public static long[] asLong(int[] array) {
		long[] result = new long[array.length];
		for (int i = 0; i < array.length; i++)
			result[i] = array[i];
		return result;
	}

	public static int count(int[] array, int value) {
		int result = 0;
		for (int i : array) {
			if (i == value)
				result++;
		}
		return result;
	}

	public static int count(char[] array, char value) {
		int result = 0;
		for (char i : array) {
			if (i == value)
				result++;
		}
		return result;
	}

	public static int count(boolean[] array, boolean value) {
		int result = 0;
		for (boolean i : array) {
			if (i == value)
				result++;
		}
		return result;
	}

	public static int[] merge(int[] first, int[] second) {
		int[] result = new int[first.length + second.length];
		int firstIndex = 0;
		int secondIndex = 0;
		int index = 0;
		while (firstIndex < first.length && secondIndex < second.length) {
			if (first[firstIndex] < second[secondIndex])
				result[index++] = first[firstIndex++];
			else
				result[index++] = second[secondIndex++];
		}
		System.arraycopy(first, firstIndex, result, index, first.length
				- firstIndex);
		System.arraycopy(second, secondIndex, result, index, second.length
				- secondIndex);
		return result;
	}

	public static boolean nextPermutation(int[] array) {
		return nextPermutation(array, IntComparator.DEFAULT);
	}

	private static boolean nextPermutation(int[] array, IntComparator comparator) {
		int size = array.length;
		int last = array[size - 1];
		for (int i = size - 2; i >= 0; i--) {
			int current = array[i];
			if (comparator.compare(last, current) > 0) {
				for (int j = size - 1; j > i; j--) {
					if (comparator.compare(array[j], current) > 0) {
						swap(array, i, j);
						inPlaceReverse(array, i + 1, size);
						return true;
					}
				}
			}
			last = current;
		}
		return false;
	}

	private static void inPlaceReverse(int[] array, int first, int second) {
		for (int i = first, j = second - 1; i < j; i++, j--)
			swap(array, i, j);
	}

	private static void swap(int[] array, int first, int second) {
		if (first == second)
			return;
		int temp = array[first];
		array[first] = array[second];
		array[second] = temp;
	}

	public static <V> void reverse(V[] array) {
		for (int i = 0, j = array.length - 1; i < j; i++, j--) {
			V temp = array[i];
			array[i] = array[j];
			array[j] = temp;
		}
	}

	public static IntComparator compareBy(final int[]... arrays) {
		return new IntComparator() {
			public int compare(Integer first, Integer second) {
				for (int[] array : arrays) {
					if (array[first] != array[second])
						return Integer.compare(array[first], array[second]);
				}
				return 0;
			}
		};
	}

	public static long minElement(long[] array) {
		return array[minPosition(array)];
	}

	public static long maxElement(long[] array) {
		return array[maxPosition(array)];
	}

	public static int minPosition(long[] array) {
		return minPosition(array, 0, array.length);
	}

	public static int maxPosition(long[] array) {
		return maxPosition(array, 0, array.length);
	}

	public static int minPosition(long[] array, int from, int to) {
		if (from >= to)
			return -1;
		long min = array[from];
		int result = from;
		for (int i = from + 1; i < to; i++) {
			if (array[i] < min) {
				min = array[i];
				result = i;
			}
		}
		return result;
	}

	public static int maxPosition(long[] array, int from, int to) {
		if (from >= to)
			return -1;
		long max = array[from];
		int result = from;
		for (int i = from + 1; i < to; i++) {
			if (array[i] > max) {
				max = array[i];
				result = i;
			}
		}
		return result;
	}

	public static int[] createArray(int count, int value) {
		int[] array = new int[count];
		Arrays.fill(array, value);
		return array;
	}

	public static long[] createArray(int count, long value) {
		long[] array = new long[count];
		Arrays.fill(array, value);
		return array;
	}

	public static double[] createArray(int count, double value) {
		double[] array = new double[count];
		Arrays.fill(array, value);
		return array;
	}

	public static boolean[] createArray(int count, boolean value) {
		boolean[] array = new boolean[count];
		Arrays.fill(array, value);
		return array;
	}

	public static char[] createArray(int count, char value) {
		char[] array = new char[count];
		Arrays.fill(array, value);
		return array;
	}

	public static <T> T[] createArray(int count, T value) {
		@SuppressWarnings("unchecked")
		T[] array = (T[]) Array.newInstance(value.getClass(), count);
		Arrays.fill(array, value);
		return array;
	}
}

class Graph {
	public static final int REMOVED_BIT = 0;

	protected int vertexCount;
	protected int edgeCount;

	private int[] firstOutbound;
	private int[] firstInbound;

	private Edge[] edges;
	private int[] nextInbound;
	private int[] nextOutbound;
	private int[] from;
	private int[] to;
	private long[] weight;
	private long[] capacity;
	private int[] reverseEdge;
	private int[] flags;

	public Graph(int vertexCount) {
		this(vertexCount, vertexCount);
	}

	public Graph(int vertexCount, int edgeCapacity) {
		this.vertexCount = vertexCount;
		firstOutbound = new int[vertexCount];
		Arrays.fill(firstOutbound, -1);

		from = new int[edgeCapacity];
		to = new int[edgeCapacity];
		nextOutbound = new int[edgeCapacity];
		flags = new int[edgeCapacity];
	}

	public static Graph createGraph(int vertexCount, int[] from, int[] to) {
		Graph graph = new Graph(vertexCount, from.length);
		for (int i = 0; i < from.length; i++)
			graph.addSimpleEdge(from[i], to[i]);
		return graph;
	}

	public static Graph createWeightedGraph(int vertexCount, int[] from,
			int[] to, long[] weight) {
		Graph graph = new Graph(vertexCount, from.length);
		for (int i = 0; i < from.length; i++)
			graph.addWeightedEdge(from[i], to[i], weight[i]);
		return graph;
	}

	public static Graph createFlowGraph(int vertexCount, int[] from, int[] to,
			long[] capacity) {
		Graph graph = new Graph(vertexCount, from.length * 2);
		for (int i = 0; i < from.length; i++)
			graph.addFlowEdge(from[i], to[i], capacity[i]);
		return graph;
	}

	public static Graph createFlowWeightedGraph(int vertexCount, int[] from,
			int[] to, long[] weight, long[] capacity) {
		Graph graph = new Graph(vertexCount, from.length * 2);
		for (int i = 0; i < from.length; i++)
			graph.addFlowWeightedEdge(from[i], to[i], weight[i], capacity[i]);
		return graph;
	}

	public static Graph createTree(int[] parent) {
		Graph graph = new Graph(parent.length + 1, parent.length);
		for (int i = 0; i < parent.length; i++)
			graph.addSimpleEdge(parent[i], i + 1);
		return graph;
	}

	public int addEdge(int fromID, int toID, long weight, long capacity,
			int reverseEdge) {
		ensureEdgeCapacity(edgeCount + 1);
		if (firstOutbound[fromID] != -1)
			nextOutbound[edgeCount] = firstOutbound[fromID];
		else
			nextOutbound[edgeCount] = -1;
		firstOutbound[fromID] = edgeCount;
		if (firstInbound != null) {
			if (firstInbound[toID] != -1)
				nextInbound[edgeCount] = firstInbound[toID];
			else
				nextInbound[edgeCount] = -1;
			firstInbound[toID] = edgeCount;
		}
		this.from[edgeCount] = fromID;
		this.to[edgeCount] = toID;
		if (capacity != 0) {
			if (this.capacity == null)
				this.capacity = new long[from.length];
			this.capacity[edgeCount] = capacity;
		}
		if (weight != 0) {
			if (this.weight == null)
				this.weight = new long[from.length];
			this.weight[edgeCount] = weight;
		}
		if (reverseEdge != -1) {
			if (this.reverseEdge == null) {
				this.reverseEdge = new int[from.length];
				Arrays.fill(this.reverseEdge, 0, edgeCount, -1);
			}
			this.reverseEdge[edgeCount] = reverseEdge;
		}
		if (edges != null)
			edges[edgeCount] = createEdge(edgeCount);
		return edgeCount++;
	}

	protected final GraphEdge createEdge(int id) {
		return new GraphEdge(id);
	}

	public final int addFlowWeightedEdge(int from, int to, long weight,
			long capacity) {
		if (capacity == 0) {
			return addEdge(from, to, weight, 0, -1);
		} else {
			int lastEdgeCount = edgeCount;
			addEdge(to, from, -weight, 0, lastEdgeCount + entriesPerEdge());
			return addEdge(from, to, weight, capacity, lastEdgeCount);
		}
	}

	protected int entriesPerEdge() {
		return 1;
	}

	public final int addFlowEdge(int from, int to, long capacity) {
		return addFlowWeightedEdge(from, to, 0, capacity);
	}

	public final int addWeightedEdge(int from, int to, long weight) {
		return addFlowWeightedEdge(from, to, weight, 0);
	}

	public final int addSimpleEdge(int from, int to) {
		return addWeightedEdge(from, to, 0);
	}

	public final int vertexCount() {
		return vertexCount;
	}

	public final int edgeCount() {
		return edgeCount;
	}

	protected final int edgeCapacity() {
		return from.length;
	}

	public final Edge edge(int id) {
		initEdges();
		return edges[id];
	}

	public final int firstOutbound(int vertex) {
		int id = firstOutbound[vertex];
		while (id != -1 && isRemoved(id))
			id = nextOutbound[id];
		return id;
	}

	public final int nextOutbound(int id) {
		id = nextOutbound[id];
		while (id != -1 && isRemoved(id))
			id = nextOutbound[id];
		return id;
	}

	public final int firstInbound(int vertex) {
		initInbound();
		int id = firstInbound[vertex];
		while (id != -1 && isRemoved(id))
			id = nextInbound[id];
		return id;
	}

	public final int nextInbound(int id) {
		initInbound();
		id = nextInbound[id];
		while (id != -1 && isRemoved(id))
			id = nextInbound[id];
		return id;
	}

	public final int source(int id) {
		return from[id];
	}

	public final int destination(int id) {
		return to[id];
	}

	public final long weight(int id) {
		if (weight == null)
			return 0;
		return weight[id];
	}

	public final long capacity(int id) {
		if (capacity == null)
			return 0;
		return capacity[id];
	}

	public final long flow(int id) {
		if (reverseEdge == null)
			return 0;
		return capacity[reverseEdge[id]];
	}

	public final void pushFlow(int id, long flow) {
		if (flow == 0)
			return;
		if (flow > 0) {
			if (capacity(id) < flow)
				throw new IllegalArgumentException("Not enough capacity");
		} else {
			if (flow(id) < -flow)
				throw new IllegalArgumentException("Not enough capacity");
		}
		capacity[id] -= flow;
		capacity[reverseEdge[id]] += flow;
	}

	public int transposed(int id) {
		return -1;
	}

	public final int reverse(int id) {
		if (reverseEdge == null)
			return -1;
		return reverseEdge[id];
	}

	public final void addVertices(int count) {
		ensureVertexCapacity(vertexCount + count);
		Arrays.fill(firstOutbound, vertexCount, vertexCount + count, -1);
		if (firstInbound != null)
			Arrays.fill(firstInbound, vertexCount, vertexCount + count, -1);
		vertexCount += count;
	}

	protected final void initEdges() {
		if (edges == null) {
			edges = new Edge[from.length];
			for (int i = 0; i < edgeCount; i++)
				edges[i] = createEdge(i);
		}
	}

	public final void removeVertex(int vertex) {
		int id = firstOutbound[vertex];
		while (id != -1) {
			removeEdge(id);
			id = nextOutbound[id];
		}
		initInbound();
		id = firstInbound[vertex];
		while (id != -1) {
			removeEdge(id);
			id = nextInbound[id];
		}
	}

	private void initInbound() {
		if (firstInbound == null) {
			firstInbound = new int[firstOutbound.length];
			Arrays.fill(firstInbound, 0, vertexCount, -1);
			nextInbound = new int[from.length];
			for (int i = 0; i < edgeCount; i++) {
				nextInbound[i] = firstInbound[to[i]];
				firstInbound[to[i]] = i;
			}
		}
	}

	public final boolean flag(int id, int bit) {
		return (flags[id] >> bit & 1) != 0;
	}

	public final void setFlag(int id, int bit) {
		flags[id] |= 1 << bit;
	}

	public final void removeFlag(int id, int bit) {
		flags[id] &= -1 - (1 << bit);
	}

	public final void removeEdge(int id) {
		setFlag(id, REMOVED_BIT);
	}

	public final void restoreEdge(int id) {
		removeFlag(id, REMOVED_BIT);
	}

	public final boolean isRemoved(int id) {
		return flag(id, REMOVED_BIT);
	}

	public final Iterable<Edge> outbound(final int id) {
		initEdges();
		return new Iterable<Edge>() {
			public Iterator<Edge> iterator() {
				return new EdgeIterator(id, firstOutbound, nextOutbound);
			}
		};
	}

	public final Iterable<Edge> inbound(final int id) {
		initEdges();
		initInbound();
		return new Iterable<Edge>() {
			public Iterator<Edge> iterator() {
				return new EdgeIterator(id, firstInbound, nextInbound);
			}
		};
	}

	protected void ensureEdgeCapacity(int size) {
		if (from.length < size) {
			int newSize = Math.max(size, 2 * from.length);
			if (edges != null)
				edges = resize(edges, newSize);
			from = resize(from, newSize);
			to = resize(to, newSize);
			nextOutbound = resize(nextOutbound, newSize);
			if (nextInbound != null)
				nextInbound = resize(nextInbound, newSize);
			if (weight != null)
				weight = resize(weight, newSize);
			if (capacity != null)
				capacity = resize(capacity, newSize);
			if (reverseEdge != null)
				reverseEdge = resize(reverseEdge, newSize);
			flags = resize(flags, newSize);
		}
	}

	private void ensureVertexCapacity(int size) {
		if (firstOutbound.length < size) {
			int newSize = Math.max(size, 2 * from.length);
			firstOutbound = resize(firstOutbound, newSize);
			if (firstInbound != null)
				firstInbound = resize(firstInbound, newSize);
		}
	}

	protected final int[] resize(int[] array, int size) {
		int[] newArray = new int[size];
		System.arraycopy(array, 0, newArray, 0, array.length);
		return newArray;
	}

	private long[] resize(long[] array, int size) {
		long[] newArray = new long[size];
		System.arraycopy(array, 0, newArray, 0, array.length);
		return newArray;
	}

	private Edge[] resize(Edge[] array, int size) {
		Edge[] newArray = new Edge[size];
		System.arraycopy(array, 0, newArray, 0, array.length);
		return newArray;
	}

	public final boolean isSparse() {
		return vertexCount == 0 || edgeCount * 20 / vertexCount <= vertexCount;
	}

	protected class GraphEdge implements Edge {
		protected int id;

		protected GraphEdge(int id) {
			this.id = id;
		}

		public int getSource() {
			return source(id);
		}

		public int getDestination() {
			return destination(id);
		}

		public long getWeight() {
			return weight(id);
		}

		public long getCapacity() {
			return capacity(id);
		}

		public long getFlow() {
			return flow(id);
		}

		public void pushFlow(long flow) {
			Graph.this.pushFlow(id, flow);
		}

		public boolean getFlag(int bit) {
			return flag(id, bit);
		}

		public void setFlag(int bit) {
			Graph.this.setFlag(id, bit);
		}

		public void removeFlag(int bit) {
			Graph.this.removeFlag(id, bit);
		}

		public int getTransposedID() {
			return transposed(id);
		}

		public Edge getTransposedEdge() {
			int reverseID = getTransposedID();
			if (reverseID == -1)
				return null;
			initEdges();
			return edge(reverseID);
		}

		public int getReverseID() {
			return reverse(id);
		}

		public Edge getReverseEdge() {
			int reverseID = getReverseID();
			if (reverseID == -1)
				return null;
			initEdges();
			return edge(reverseID);
		}

		public int getID() {
			return id;
		}

		public void remove() {
			removeEdge(id);
		}

		public void restore() {
			restoreEdge(id);
		}
	}

	public class EdgeIterator implements Iterator<Edge> {
		private int edgeID;
		private final int[] next;
		private int lastID = -1;

		public EdgeIterator(int id, int[] first, int[] next) {
			this.next = next;
			edgeID = nextEdge(first[id]);
		}

		private int nextEdge(int id) {
			while (id != -1 && isRemoved(id))
				id = next[id];
			return id;
		}

		public boolean hasNext() {
			return edgeID != -1;
		}

		public Edge next() {
			if (edgeID == -1)
				throw new NoSuchElementException();
			lastID = edgeID;
			edgeID = nextEdge(next[lastID]);
			return edges[lastID];
		}

		public void remove() {
			if (lastID == -1)
				throw new IllegalStateException();
			removeEdge(lastID);
			lastID = -1;
		}
	}

}

class MiscUtils {
	public static final int[] DX4 = { 1, 0, -1, 0 };
	public static final int[] DY4 = { 0, -1, 0, 1 };
	public static final int[] DX8 = { 1, 1, 1, 0, -1, -1, -1, 0 };
	public static final int[] DY8 = { -1, 0, 1, 1, 1, 0, -1, -1 };
	public static final int[] DX_KNIGHT = { 2, 1, -1, -2, -2, -1, 1, 2 };
	public static final int[] DY_KNIGHT = { 1, 2, 2, 1, -1, -2, -2, -1 };

	private static final String[] ROMAN_TOKENS = { "M", "CM", "D", "CD", "C",
			"XC", "L", "XL", "X", "IX", "V", "IV", "I" };
	private static final int[] ROMAN_VALUES = { 1000, 900, 500, 400, 100, 90,
			50, 40, 10, 9, 5, 4, 1 };

	public static long josephProblem(long n, int k) {
		if (n == 1)
			return 0;
		if (k == 1)
			return n - 1;
		if (k > n)
			return (josephProblem(n - 1, k) + k) % n;
		long count = n / k;
		long result = josephProblem(n - count, k);
		result -= n % k;
		if (result < 0)
			result += n;
		else
			result += result / (k - 1);
		return result;
	}

	public static boolean isValidCell(int row, int column, int rowCount,
			int columnCount) {
		return row >= 0 && row < rowCount && column >= 0
				&& column < columnCount;
	}

	public static List<Integer> getPath(int[] last, int destination) {
		List<Integer> path = new ArrayList<Integer>();
		while (destination != -1) {
			path.add(destination);
			destination = last[destination];
		}
		inPlaceReverse(path);
		return path;
	}

	private static void inPlaceReverse(List<Integer> list) {
		for (int i = 0, j = list.size() - 1; i < j; i++, j--)
			swap(list, i, j);
	}

	private static void swap(List<Integer> list, int first, int second) {
		if (first == second)
			return;
		int temp = list.get(first);
		list.set(first, list.get(second));
		list.set(second, temp);
	}

	public static List<Integer> getPath(int[][] lastIndex,
			int[][] lastPathNumber, int destination, int pathNumber) {
		List<Integer> path = new ArrayList<Integer>();
		while (destination != -1 || pathNumber != 0) {
			path.add(destination);
			int nextDestination = lastIndex[destination][pathNumber];
			pathNumber = lastPathNumber[destination][pathNumber];
			destination = nextDestination;
		}
		inPlaceReverse(path);
		return path;
	}

	public static long maximalRectangleSum(long[][] array) {
		int n = array.length;
		int m = array[0].length;
		long[][] partialSums = new long[n + 1][m + 1];
		for (int i = 0; i < n; i++) {
			long rowSum = 0;
			for (int j = 0; j < m; j++) {
				rowSum += array[i][j];
				partialSums[i + 1][j + 1] = partialSums[i][j + 1] + rowSum;
			}
		}
		long result = Long.MIN_VALUE;
		for (int i = 0; i < m; i++) {
			for (int j = i; j < m; j++) {
				long minPartialSum = 0;
				for (int k = 1; k <= n; k++) {
					long current = partialSums[k][j + 1] - partialSums[k][i];
					result = Math.max(result, current - minPartialSum);
					minPartialSum = Math.min(minPartialSum, current);
				}
			}
		}
		return result;
	}

	public static int parseIP(String ip) {
		String[] components = ip.split("[.]");
		int result = 0;
		for (int i = 0; i < 4; i++)
			result += (1 << (24 - 8 * i)) * Integer.parseInt(components[i]);
		return result;
	}

	public static String buildIP(int mask) {
		StringBuilder result = new StringBuilder();
		for (int i = 0; i < 4; i++) {
			if (i != 0)
				result.append('.');
			result.append(mask >> (24 - 8 * i) & 255);
		}
		return result.toString();
	}

	public static long binarySearch(long from, long to,
			Function<Long, Boolean> function) {
		while (from < to) {
			long argument = from + (to - from) / 2;
			if (function.value(argument))
				to = argument;
			else
				from = argument + 1;
		}
		return from;
	}

	public static <T> boolean equals(T first, T second) {
		return first == null && second == null || first != null
				&& first.equals(second);
	}

	public static boolean isVowel(char ch) {
		ch = Character.toUpperCase(ch);
		return ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U'
				|| ch == 'Y';
	}

	public static boolean isStrictVowel(char ch) {
		ch = Character.toUpperCase(ch);
		return ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U';
	}

	public static String convertToRoman(int number) {
		StringBuilder result = new StringBuilder();
		for (int i = 0; i < ROMAN_TOKENS.length; i++) {
			while (number >= ROMAN_VALUES[i]) {
				number -= ROMAN_VALUES[i];
				result.append(ROMAN_TOKENS[i]);
			}
		}
		return result.toString();
	}

	public static int convertFromRoman(String number) {
		int result = 0;
		for (int i = 0; i < ROMAN_TOKENS.length; i++) {
			while (number.startsWith(ROMAN_TOKENS[i])) {
				number = number.substring(ROMAN_TOKENS[i].length());
				result += ROMAN_VALUES[i];
			}
		}
		return result;
	}

	public static int distance(int x1, int y1, int x2, int y2) {
		int dx = x1 - x2;
		int dy = y1 - y2;
		return dx * dx + dy * dy;
	}

	public static <T extends Comparable<T>> T min(T first, T second) {
		if (first.compareTo(second) <= 0)
			return first;
		return second;
	}

	public static <T extends Comparable<T>> T max(T first, T second) {
		if (first.compareTo(second) <= 0)
			return second;
		return first;
	}

	public static void decreaseByOne(int[]... arrays) {
		for (int[] array : arrays) {
			for (int i = 0; i < array.length; i++)
				array[i]--;
		}
	}

	public static int[] getIntArray(String s) {
		String[] tokens = s.split(" ");
		int[] result = new int[tokens.length];
		for (int i = 0; i < result.length; i++)
			result[i] = Integer.parseInt(tokens[i]);
		return result;
	}
}

class IntegerUtils {
	public static long gcd(long a, long b) {
		a = Math.abs(a);
		b = Math.abs(b);
		while (b != 0) {
			long temp = a % b;
			a = b;
			b = temp;
		}
		return a;
	}

	public static int gcd(int a, int b) {
		a = Math.abs(a);
		b = Math.abs(b);
		while (b != 0) {
			int temp = a % b;
			a = b;
			b = temp;
		}
		return a;
	}

	public static int[] generatePrimes(int upTo) {
		int[] isPrime = generateBitPrimalityTable(upTo);
		List<Integer> primes = new ArrayList<Integer>();
		for (int i = 0; i < upTo; i++) {
			if ((isPrime[i >> 5] >>> (i & 31) & 1) == 1)
				primes.add(i);
		}
		int[] array = new int[primes.size()];
		for (int i = 0; i < array.length; i++)
			array[i] = primes.get(i);
		return array;
	}

	public static boolean[] generatePrimalityTable(int upTo) {
		boolean[] isPrime = new boolean[upTo];
		if (upTo < 2)
			return isPrime;
		Arrays.fill(isPrime, true);
		isPrime[0] = isPrime[1] = false;
		for (int i = 2; i * i < upTo; i++) {
			if (isPrime[i]) {
				for (int j = i * i; j < upTo; j += i)
					isPrime[j] = false;
			}
		}
		return isPrime;
	}

	public static int[] generateBitPrimalityTable(int upTo) {
		int[] isPrime = new int[(upTo + 31) >> 5];
		if (upTo < 2)
			return isPrime;
		Arrays.fill(isPrime, -1);
		isPrime[0] &= -4;
		for (int i = 2; i * i < upTo; i++) {
			if ((isPrime[i >> 5] >>> (i & 31) & 1) == 1) {
				for (int j = i * i; j < upTo; j += i)
					isPrime[j >> 5] &= -1 - (1 << (j & 31));
			}
		}
		return isPrime;
	}

	public static int[] generateDivisorTable(int upTo) {
		int[] divisor = new int[upTo];
		for (int i = 1; i < upTo; i++)
			divisor[i] = i;
		for (int i = 2; i * i < upTo; i++) {
			if (divisor[i] == i) {
				for (int j = i * i; j < upTo; j += i)
					divisor[j] = i;
			}
		}
		return divisor;
	}

	public static long powerInFactorial(long n, long p) {
		long result = 0;
		while (n != 0) {
			result += n /= p;
		}
		return result;
	}

	public static int sumDigits(CharSequence number) {
		int result = 0;
		for (int i = number.length() - 1; i >= 0; i--)
			result += digitValue(number.charAt(i));
		return result;
	}

	public static int digitValue(char digit) {
		if (Character.isDigit(digit))
			return digit - '0';
		if (Character.isUpperCase(digit))
			return digit + 10 - 'A';
		return digit + 10 - 'a';
	}

	public static int longCompare(long a, long b) {
		if (a < b)
			return -1;
		if (a > b)
			return 1;
		return 0;
	}

	public static long[][] generateBinomialCoefficients(int n) {
		long[][] result = new long[n + 1][n + 1];
		for (int i = 0; i <= n; i++) {
			result[i][0] = 1;
			for (int j = 1; j <= i; j++)
				result[i][j] = result[i - 1][j - 1] + result[i - 1][j];
		}
		return result;
	}

	public static long[][] generateBinomialCoefficients(int n, long module) {
		long[][] result = new long[n + 1][n + 1];
		if (module == 1)
			return result;
		for (int i = 0; i <= n; i++) {
			result[i][0] = 1;
			for (int j = 1; j <= i; j++) {
				result[i][j] = result[i - 1][j - 1] + result[i - 1][j];
				if (result[i][j] >= module)
					result[i][j] -= module;
			}
		}
		return result;
	}

	public static long[] generateBinomialRow(int n, long module) {
		long[] result = generateReverse(n + 1, module);
		result[0] = 1;
		for (int i = 1; i <= n; i++)
			result[i] = result[i - 1] * (n - i + 1) % module * result[i]
					% module;
		return result;
	}

	public static int[] representationInBase(long number, int base) {
		long basePower = base;
		int exponent = 1;
		while (number >= basePower) {
			basePower *= base;
			exponent++;
		}
		int[] representation = new int[exponent];
		for (int i = 0; i < exponent; i++) {
			basePower /= base;
			representation[i] = (int) (number / basePower);
			number %= basePower;
		}
		return representation;
	}

	public static int trueDivide(int a, int b) {
		return (a - trueMod(a, b)) / b;
	}

	public static long trueDivide(long a, long b) {
		return (a - trueMod(a, b)) / b;
	}

	public static int trueMod(int a, int b) {
		a %= b;
		a += b;
		a %= b;
		return a;
	}

	public static long trueMod(long a, long b) {
		a %= b;
		a += b;
		a %= b;
		return a;
	}

	public static long factorial(int n) {
		long result = 1;
		for (int i = 2; i <= n; i++)
			result *= i;
		return result;
	}

	public static long factorial(int n, long mod) {
		long result = 1;
		for (int i = 2; i <= n; i++)
			result = result * i % mod;
		return result % mod;
	}

	public static List<Pair<Long, Integer>> factorize(long number) {
		List<Pair<Long, Integer>> result = new ArrayList<Pair<Long, Integer>>();
		for (long i = 2; i * i <= number; i++) {
			if (number % i == 0) {
				int power = 0;
				do {
					power++;
					number /= i;
				} while (number % i == 0);
				result.add(Pair.makePair(i, power));
			}
		}
		if (number != 1)
			result.add(Pair.makePair(number, 1));
		return result;
	}

	public static List<Long> getDivisors(long number) {
		List<Pair<Long, Integer>> primeDivisors = factorize(number);
		return getDivisorsImpl(primeDivisors, 0, 1, new ArrayList<Long>());
	}

	private static List<Long> getDivisorsImpl(
			List<Pair<Long, Integer>> primeDivisors, int index, long current,
			List<Long> result) {
		if (index == primeDivisors.size()) {
			result.add(current);
			return result;
		}
		long p = primeDivisors.get(index).first;
		int power = primeDivisors.get(index).second;
		for (int i = 0; i <= power; i++) {
			getDivisorsImpl(primeDivisors, index + 1, current, result);
			current *= p;
		}
		return result;
	}

	public static long power(long base, long exponent) {
		if (exponent == 0)
			return 1;
		long result = power(base, exponent >> 1);
		result = result * result;
		if ((exponent & 1) != 0)
			result = result * base;
		return result;
	}

	public static long power(long base, long exponent, long mod) {
		if (base >= mod)
			base %= mod;
		if (exponent == 0)
			return 1 % mod;
		long result = power(base, exponent >> 1, mod);
		result = result * result % mod;
		if ((exponent & 1) != 0)
			result = result * base % mod;
		return result;
	}

	public static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	public static long[] generateFibonacci(long upTo) {
		int count = 0;
		long last = 0;
		long current = 1;
		while (current <= upTo) {
			long next = last + current;
			last = current;
			current = next;
			count++;
		}
		return generateFibonacci(count, -1);
	}

	public static long[] generateFibonacci(int count, long module) {
		long[] result = new long[count];
		if (module == -1) {
			if (count != 0)
				result[0] = 1;
			if (count > 1)
				result[1] = 1;
			for (int i = 2; i < count; i++)
				result[i] = result[i - 1] + result[i - 2];
		} else {
			if (count != 0)
				result[0] = 1 % module;
			if (count > 1)
				result[1] = 1 % module;
			for (int i = 2; i < count; i++)
				result[i] = (result[i - 1] + result[i - 2]) % module;
		}
		return result;
	}

	public static long[] generateHappy(int digits) {
		long[] happy = new long[(1 << (digits + 1)) - 2];
		happy[0] = 4;
		happy[1] = 7;
		int first = 0;
		int last = 2;
		for (int i = 2; i <= digits; i++) {
			for (int j = 0; j < last - first; j++) {
				happy[last + 2 * j] = 10 * happy[first + j] + 4;
				happy[last + 2 * j + 1] = 10 * happy[first + j] + 7;
			}
			int next = last + 2 * (last - first);
			first = last;
			last = next;
		}
		return happy;
	}

	public static long[] generateFactorial(int count, long module) {
		long[] result = new long[count];
		if (module == -1) {
			if (count != 0)
				result[0] = 1;
			for (int i = 1; i < count; i++)
				result[i] = result[i - 1] * i;
		} else {
			if (count != 0)
				result[0] = 1 % module;
			for (int i = 1; i < count; i++)
				result[i] = (result[i - 1] * i) % module;
		}
		return result;
	}

	public static long reverse(long number, long module) {
		return power(number, module - 2, module);
	}

	public static boolean isPrime(long number) {
		if (number < 2)
			return false;
		for (long i = 2; i * i <= number; i++) {
			if (number % i == 0)
				return false;
		}
		return true;
	}

	public static long[] generateReverse(int upTo, long module) {
		long[] result = new long[upTo];
		if (upTo > 1)
			result[1] = 1;
		for (int i = 2; i < upTo; i++)
			result[i] = (module - module / i * result[((int) (module % i))]
					% module)
					% module;
		return result;
	}

	public static long[] generateReverseFactorials(int upTo, long module) {
		long[] result = generateReverse(upTo, module);
		if (upTo > 0)
			result[0] = 1;
		for (int i = 1; i < upTo; i++)
			result[i] = result[i] * result[i - 1] % module;
		return result;
	}

	public static long[] generatePowers(long base, int count, long mod) {
		long[] result = new long[count];
		if (count != 0)
			result[0] = 1 % mod;
		for (int i = 1; i < count; i++)
			result[i] = result[i - 1] * base % mod;
		return result;
	}

	public static long nextPrime(long from) {
		if (from <= 2)
			return 2;
		from += 1 - (from & 1);
		while (!isPrime(from))
			from += 2;
		return from;
	}

	public static long binomialCoefficient(int n, int m, long mod) {
		if (m < 0 || m > n)
			return 0;
		if (2 * m > n)
			m = n - m;
		long result = 1;
		for (int i = n - m + 1; i <= n; i++)
			result = result * i % mod;
		return result
				* BigInteger.valueOf(factorial(m, mod))
						.modInverse(BigInteger.valueOf(mod)).longValue() % mod;
	}

	public static boolean isSquare(long number) {
		long sqrt = Math.round(Math.sqrt(number));
		return sqrt * sqrt == number;
	}

	public static long findCommon(long aRemainder, long aMod, long bRemainder,
			long bMod) {
		long modGCD = gcd(aMod, bMod);
		long gcdRemainder = aRemainder % modGCD;
		if (gcdRemainder != bRemainder % modGCD)
			return -1;
		aMod /= modGCD;
		aRemainder /= modGCD;
		bMod /= modGCD;
		bRemainder /= modGCD;
		long aReverse = BigInteger.valueOf(aMod)
				.modInverse(BigInteger.valueOf(bMod)).longValue();
		long bReverse = BigInteger.valueOf(bMod)
				.modInverse(BigInteger.valueOf(aMod)).longValue();
		long mod = aMod * bMod;
		return (bReverse * aRemainder % mod * bMod + aReverse * bRemainder
				% mod * aMod)
				% mod * modGCD + gcdRemainder;
	}

	public static long[] generatePowers(long base, long maxValue) {
		if (maxValue <= 0)
			return new long[0];
		int size = 1;
		long current = 1;
		while (maxValue / base >= current) {
			current *= base;
			size++;
		}
		return generatePowers(base, size, Long.MAX_VALUE);
	}
}

interface IntComparator extends Comparator<Integer> {
	public static final IntComparator DEFAULT = new IntComparator() {
		public int compare(Integer first, Integer second) {
			if (first < second)
				return -1;
			if (first > second)
				return 1;
			return 0;
		}
	};

	public static final IntComparator REVERSE = new IntComparator() {
		public int compare(Integer first, Integer second) {
			if (first < second)
				return 1;
			if (first > second)
				return -1;
			return 0;
		}
	};

	public int compare(Integer first, Integer second);
}

class BidirectionalGraph extends Graph {
	public int[] transposedEdge;

	public BidirectionalGraph(int vertexCount) {
		this(vertexCount, vertexCount);
	}

	public BidirectionalGraph(int vertexCount, int edgeCapacity) {
		super(vertexCount, 2 * edgeCapacity);
		transposedEdge = new int[2 * edgeCapacity];
	}

	public static BidirectionalGraph createGraph(int vertexCount, int[] from,
			int[] to) {
		BidirectionalGraph graph = new BidirectionalGraph(vertexCount,
				from.length);
		for (int i = 0; i < from.length; i++)
			graph.addSimpleEdge(from[i], to[i]);
		return graph;
	}

	public static BidirectionalGraph createWeightedGraph(int vertexCount,
			int[] from, int[] to, long[] weight) {
		BidirectionalGraph graph = new BidirectionalGraph(vertexCount,
				from.length);
		for (int i = 0; i < from.length; i++)
			graph.addWeightedEdge(from[i], to[i], weight[i]);
		return graph;
	}

	public static BidirectionalGraph createFlowGraph(int vertexCount,
			int[] from, int[] to, long[] capacity) {
		BidirectionalGraph graph = new BidirectionalGraph(vertexCount,
				from.length * 2);
		for (int i = 0; i < from.length; i++)
			graph.addFlowEdge(from[i], to[i], capacity[i]);
		return graph;
	}

	public static BidirectionalGraph createFlowWeightedGraph(int vertexCount,
			int[] from, int[] to, long[] weight, long[] capacity) {
		BidirectionalGraph graph = new BidirectionalGraph(vertexCount,
				from.length * 2);
		for (int i = 0; i < from.length; i++)
			graph.addFlowWeightedEdge(from[i], to[i], weight[i], capacity[i]);
		return graph;
	}

	@Override
	public int addEdge(int fromID, int toID, long weight, long capacity,
			int reverseEdge) {
		int lastEdgeCount = edgeCount;
		super.addEdge(fromID, toID, weight, capacity, reverseEdge);
		super.addEdge(toID, fromID, weight, capacity, reverseEdge == -1 ? -1
				: reverseEdge + 1);
		this.transposedEdge[lastEdgeCount] = lastEdgeCount + 1;
		this.transposedEdge[lastEdgeCount + 1] = lastEdgeCount;
		return lastEdgeCount;
	}

	@Override
	protected int entriesPerEdge() {
		return 2;
	}

	@Override
	public final int transposed(int id) {
		return transposedEdge[id];
	}

	@Override
	protected void ensureEdgeCapacity(int size) {
		if (size > edgeCapacity()) {
			super.ensureEdgeCapacity(size);
			transposedEdge = resize(transposedEdge, edgeCapacity());
		}
	}
}

class Pair<U, V> implements Comparable<Pair<U, V>> {
	public final U first;
	public final V second;

	public static <U, V> Pair<U, V> makePair(U first, V second) {
		return new Pair<U, V>(first, second);
	}

	private Pair(U first, V second) {
		this.first = first;
		this.second = second;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		Pair pair = (Pair) o;

		return !(first != null ? !first.equals(pair.first) : pair.first != null)
				&& !(second != null ? !second.equals(pair.second)
						: pair.second != null);

	}

	@Override
	public int hashCode() {
		int result = first != null ? first.hashCode() : 0;
		result = 31 * result + (second != null ? second.hashCode() : 0);
		return result;
	}

	public Pair<V, U> swap() {
		return makePair(second, first);
	}

	@Override
	public String toString() {
		return "(" + first + "," + second + ")";
	}

	@SuppressWarnings({ "unchecked" })
	public int compareTo(Pair<U, V> o) {
		int value = ((Comparable<U>) first).compareTo(o.first);
		if (value != 0)
			return value;
		return ((Comparable<V>) second).compareTo(o.second);
	}
}

interface Edge {
	public int getSource();

	public int getDestination();

	public long getWeight();

	public long getCapacity();

	public long getFlow();

	public void pushFlow(long flow);

	public boolean getFlag(int bit);

	public void setFlag(int bit);

	public void removeFlag(int bit);

	public int getTransposedID();

	public Edge getTransposedEdge();

	public int getReverseID();

	public Edge getReverseEdge();

	public int getID();

	public void remove();

	public void restore();
}

interface Function<A, V> {
	public abstract V value(A argument);
}

import java.io.*;
import java.math.*;
import java.util.*;

public class SolutionA{

	public static void main(String[] args){
		new SolutionA().run();
	}

	long go(long n, long k){
		if(n <= 0 || k <= 0) return 0;
		long t = n * k;
		while(n > 0 && k > 0){
			if(n > k) n %= k;
			else k %= n;
		}
		return t/(n + k);
	}
	long go(long n, long k, long m){
		long t = go(n, k);
		return go(t, m);
	}
	void solve(){
		int n = in.nextInt();
		long t = 0;
		for(int i=n-3; i<=n; i++){
			for(int j = i; j<=n; j++)
				for(int k = j; k <= n; k++){
					t = Math.max(go(i, j, k), t);
				}
		}
		out.println(t);
	}

	class Pair implements Comparable<Pair>{
		int x, y;
		Pair(int x, int y){
			this.x = x;
			this.y = y;
		}
		@Override
		public int compareTo(Pair o) {
			if(o.x == x) return ((Integer) y).compareTo(o.y);
			return ((Integer) x).compareTo(o.x);
		}

	}
	FastScanner in;
	PrintWriter out;
	void run(){
		in = new FastScanner(System.in);
		out = new PrintWriter(new OutputStreamWriter(System.out));
		solve();
		out.close();
	}

	void runIO(){
		try{
			in = new FastScanner(new File("expr.in"));
			out = new PrintWriter(new FileWriter(new File("expr.out")));
			solve();
			out.close();
		}catch(Exception ex){
			ex.printStackTrace();
		}
	}
	class FastScanner{
		BufferedReader bf;
		StringTokenizer st;
		public FastScanner(File f){
			try{
				bf = new BufferedReader(new FileReader(f));
			}
			catch(IOException ex){
				ex.printStackTrace();
			}
		}
		public FastScanner(InputStream is){
			bf = new BufferedReader(new InputStreamReader(is));
		}
		String next(){
			while(st == null || !st.hasMoreTokens()){
				try{
					st = new StringTokenizer(bf.readLine());
				}
				catch(IOException ex){
					ex.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		float nextFloat(){
			return Float.parseFloat(next());
		}
		String nextLine(){
			try{
				return bf.readLine();
			}
			catch(Exception ex){
				ex.printStackTrace();
			}
			return "";
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		BigInteger nextBigInteger(){
			return new BigInteger(next());
		}
		BigDecimal nextBigDecimal(){
			return new BigDecimal(next());
		}
		int[] nextIntArray(int n){
			int a[] = new int[n];
			for(int i = 0; i < n; i++)
				a[i] = Integer.parseInt(next());
			return a;
		}
		long[] nextLongArray(int n){
			long a[] = new long[n];
			for(int i = 0; i < n; i++)
				a[i] = Long.parseLong(next());
			return a;
		}
	}
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

        bw.append(solve(Integer.parseInt(br.readLine()))+"\n");
        bw.close();

    }

    private static long solve(int x) {
        if(x==1) return 1;
        if(x==2) return 2;
        if(x==3) return 6;
        if(x%2==1) return 1l*x*(x-1)*(x-2);
        else{
            if(x%3==0) {
                return 1l*(x-1)*(x-2)*(x-3);
            }
            return 1l*x*(x-1)*(x-3);
        }

    }

}

//package concept;

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/*
 * Eclipse Photon
 * @uthor masterbios
 *
 */
public class Main{
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskAA solver = new TaskAA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskAA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	long n = in.nextLong();
        	long ans = 0;
        	for(long i=Math.max(1L, n-10);i<=n;i++) {
        		for(long j=i;j<=n;j++) {
        			for(long k=j;k<=n;k++) {
        				ans = Math.max(ans, lcm(i,lcm(j,k)));
        			}
        		}
        	}
        	out.println(ans);
        }
        public long gcd(long a,long b) {
        	if(a==0)return b;
        	return gcd(b%a,a);
        }
        public long lcm(long a,long b) {
        	return (a*b)/gcd(a,b);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreElements()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public Double nextDouble() {
        	return Double.parseDouble(next());
        }
        public char nextChar() {
        	return next().charAt(0);
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author zodiacLeo
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            long max = -1;
            long n = in.nextLong();
            for (long i = Math.max(1, n - 100); i <= n; i++)
            {
                for (long j = i; j <= n; j++)
                {
                    for (long k = j; k <= n; k++)
                    {
                        max = Math.max(max, lcm(i, lcm(j, k)));
                    }
                }
            }
            out.println(max);
        }

        public long lcm(long a, long b)
        {
            return a * b / gcd(a, b);
        }

        public long gcd(long a, long b)
        {
            return b == 0 ? a : gcd(b, a % b);
        }

    }
}

import java.io.*;
import java.util.*;

public class Example {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(in.readLine());
            } catch (Exception e) {
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    static long lcm(long a, long b) {
        long res = a * (a - 1);
        res = res * b / gcd(res, b);
        return res;
    }

    public void run() throws Exception {
        //in = new BufferedReader(new FileReader("D.IN"));
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        long n = nextLong();
        long ans = 0;
        for (long x = n; x >= 2 && x > n - 100; x--) {
            for (long y = x - 1; y > n - 1000 && y >= 1; y--) {
                long nok = lcm(x, y);
                if (ans < nok) {
                    ans = nok;
                }
            }
        }
        if (n == 1) {
            ans = 1;
        }
        out.println(ans);
        out.flush();
        out.close();
        in.close();
    }

    public static void main(String[] args) throws Exception {
        new Example().run();
    }
}

//package Codeforces;

import java.util.Scanner;

public class lcmChallenge {
	static long gcd(long a, long b) {
		return b==0?a:gcd(b, a%b);
	}
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	if(n==2||n==1)
		System.out.println(n);
	else if(n==3)
		System.out.println(6);
	else {
		long ans = 1;
		for (int i = 4; i <=n; i++) {

			long gcd = gcd(i, i-1);
			long lcm = i*1l*(i-1);
			long third =i-2;
			gcd = gcd(third, lcm);
			while(gcd!=1&&third>1) {
				ans= Math.max(ans, lcm*third/gcd);
//				System.out.println(lcm*third/gcd+" "+third);
				third--;
				gcd = gcd(third, lcm);
			}
			lcm*=(third);
			ans = Math.max(lcm, ans);

		}

		System.out.println(ans);
	}
}
}

import java.util.Scanner;

public class A235 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt();
        if (n == 1) {
            System.out.println(1);
            return;
        } else if (n == 2) {
            System.out.println(2);
            return;
        } else if (n == 3) {
            System.out.println(6);
            return;
        }

        if (n % 2 == 0) {
            if(n % 3 == 0)
                System.out.println((n - 1) * (n - 2) * (n - 3));
            else
                System.out.println((n - 1) * n * (n - 3));
        } else {
            System.out.println(n * (n - 1) * (n - 2));
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author JENISH
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CLCMChallenge solver = new CLCMChallenge();
        solver.solve(1, in, out);
        out.close();
    }

    static class CLCMChallenge {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            long n = in.scanLong();

            if (n == 1) {
                out.println(1);
                return;
            }

            if (n == 2) {
                out.println(2);
                return;
            }

//         for (n = 3; n <= 70; n++) {
            long ans = n * (n - 1);
            for (int i = 1; i <= n; i++) {
                if (i - 2 >= 1) {
                    ans = Math.max(ans, LCM(i - 2, LCM(i, i - 1)));
                }
            }

            for (int i = 1; i <= n; i++) {
                ans = Math.max(ans, LCM(i, LCM(n, n - 1)));
            }

            long aa = ans;

//        for (int i = 1; i < n; i++) {
//            for (int j = 1; j <= n; j++) {
//                for (int k = 1; k <= n; k++) {
//                    ans = Math.max(ans, LCM(k, LCM(i, j)));
//
//                }
//            }
//        }

//        out.println(n + " " + (aa == ans));
            out.println(ans);
//        }

        }

        long LCM(long a, long b) {
            return (a * b) / CodeX.GCD(a, b);
        }

    }

    static class CodeX {
        public static long GCD(long A, long B) {
            if (B == 0)
                return A;
            else
                return GCD(B, A % B);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

        public long scanLong() {
            long I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

    }
}

import java.io.BufferedInputStream;
import java.util.Scanner;

/**
 * Created by jizhe on 2016/1/29.
 */
public class LCMChallenge {
    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));

        long N = in.nextLong();
        if( N == 1 || N == 2 )
        {
            System.out.printf("%d\n", N);
            return;
        }

        if( (N&1) == 1 )
        {
            long lcm = N*(N-1)*(N-2);
            System.out.printf("%d\n", lcm);
        }
        else
        {
            if( N == 4 )
            {
                System.out.printf("12\n");
            }
            else
            {
                long lcm;
                if( N%3 == 0 )
                {
                    lcm = (N-1)*(N-2)*(N-3);
                }
                else
                {
                    lcm = N*(N-1)*(N-3);
                }

                System.out.printf("%d\n", lcm);
            }
        }
    }
}

import java.io.BufferedReader;
// import java.io.FileInputStream;
// import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.util.Arrays.fill;

public class Main {
    FastScanner in;
    PrintWriter out;

    long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    private void solve() throws IOException {
        long n = in.nextLong(), ans = 1, cur;
        for (int i = 0; i < 100; i++) {
            for (int j = 0; j < 100; j++) {
                for (int k = 0; k < 100; k++) {
                    cur = max(1, (n - i)) * max(1, (n - j)) / gcd(max(1, n - i), max(1, n - j));
                    cur = cur * max(1, (n - k)) / gcd(cur, max(1, n - k));
                    ans = max(ans, cur);
                }
            }
        }
        out.print(ans);
    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        boolean hasNext() throws IOException {
            return br.ready() || (st != null && st.hasMoreTokens());
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next().replace(',', '.'));
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

        boolean hasNextLine() throws IOException {
            return br.ready();
        }

    }

    private void run() throws IOException {
        in = new FastScanner(System.in); // new FastScanner(new FileInputStream(".in"));
        out = new PrintWriter(System.out); // new PrintWriter(new FileOutputStream(".out"));

        solve();

        out.flush();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }
}

import java.util.*;
public class cf235a {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    long ans = 1;
    for(int i=0; i<Math.min(n,100); i++)
      for(int j=i; j<Math.min(n,100); j++)
        for(int k=j; k<Math.min(n,100); k++)
          ans = Math.max(ans,lcm(n-i,n-j,n-k));
    System.out.println(ans);
  }
  static long lcm(long a, long b, long c) {
    return lcm(lcm(a,b),c);
  }
  static long lcm(long a, long b) {
    return a*b/gcd(a,b);
  }
  static long gcd(long a, long b) {
    return b==0?a:gcd(b,a%b);
  }
}

/*
 * Remember a 7.0 student can know more than a 10.0 student.
 * Grades don't determine intelligence, they test obedience.
 * I Never Give Up.
 */
import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.text.*;

import static java.lang.System.out;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class ContestMain {
	private static Reader in=new Reader();
	private static StringBuilder ans=new StringBuilder();
	private static long MOD=1000000007;//10^9+7
	private static final int N=100000+7; //10^5
//	private static final int LIM=26;
//	private static final double PI=3.1415;
//	private static ArrayList<Integer> v[]=new ArrayList[N];
//	private static int color[]=new int[N];
//	private static boolean mark[]=new boolean[N];
//	private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//	private static void dfs(int node){mark[node]=true;for(int x:v[node]){if(!mark[x]){dfs(x);}}}
	private static long powmod(long x,long n,long m){
		if(n==0)return 1;
		else if(n%2==0)return(powmod((x*x)%m,n/2,m));
		else return (x*(powmod((x*x)%m,(n-1)/2,m)))%m;
	}
//	private static void shuffle(long [] arr) {
//		for (int i = arr.length - 1; i >= 2; i--) {
//			int x = new Random().nextInt(i - 1);
//	        long temp = arr[x];
//	        arr[x] = arr[i];
//	        arr[i] = temp;
//	    }
//	 }
	private static long gcd(long a, long b){
		if(b==0)return a;
		return gcd(b,a%b);
	}
//	private static boolean check(int x,int y){
//		if((x>=0&&x<n)&&(y>=0&&y<m)&&mat[x][y]!='X'&&!visited[x][y])return true;
//		return false;
//	}
	public static void main(String[] args) throws IOException{
		long n=in.nextLong();
		long res=0;
		if(n>=3){
			if(n%2!=0)res=n*(n-1)*(n-2);
			else if(n%3!=0)res=n*(n-1)*(n-3);
			else res=(n-1)*(n-2)*(n-3);
		}
		else{
			if(n==1)res=1;
			else res=n*(n-1);
		}
		out.println(res);
	}
	static class Pair<T> implements Comparable<Pair>{
		int l;
		int r;
		int c;
		Pair(){
			l=0;
			r=0;
		}
		Pair(int k,int v,int p){
			l=k;
			r=v;
			c=p;
		}
		@Override
		public int compareTo(Pair o) {
			if(o.l!=l)return (int) (l-o.l);
			else return (r-o.r);
		}

	}
	static class Reader{
        BufferedReader br;
        StringTokenizer st;
        public Reader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {

                	st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.io.*;
public class Main {

	static long gcd(long a,long b) {
		return b==0?a:gcd(b,a%b);
	}

	public static void main(String[] args) throws IOException {
		StreamTokenizer st=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		st.nextToken();
		long n=(long) st.nval;
		long ans=0;
		if(n==1||n==2) {
			System.out.println(n);
//			System.out.println(n+" "+n+" "+n);
			return ;
		}
		if(n%2==1) {
			ans=n*(n-1)*(n-2);
		}else {
			if(n%3!=0) {
				ans=n*(n-1)*(n-3);
			}else {
				ans=(n-1)*(n-2)*(n-3);
			}
		}
		System.out.println(ans);

	}

}

//number theory
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.Random;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeMap;

public class Rating1600_235A{
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        long n = in.nextLong();
        if(n<3){
            out.println(n);
        }
        else if(n%2==1){
            out.println(n*(n-1)*(n-2));
        }
        else{
            if(n%3!=0){
                out.println((long)Math.max((n-1)*(n-2)*(n-3),(n)*(n-1)*(n-3)));
            }
            else{
                out.println((n-1)*(n-2)*(n-3));
            }
        }
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return reader.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=reader.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            tokenizer=new StringTokenizer(next);
            return true;
        }
    }
}

import java.util.*;
import java.io.*;
import java.math.*;

public class LCM_Challenge {
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        Reader s = new Reader();
        long n = s.l();
        if (n == 1) {
            out.println(1);
            out.flush();
            return;
        }
        if ( n == 2) {
            out.println(2);
            out.flush();
            return;
        }
        long ans = n*(n-1);
        long prod = (n-1)*(n-2)*(n-3);
        for (int i=1;i<(int)n-1;i++) {
            long x = gcd(ans,i);
            long temp = (ans*i)/x;
            prod = Math.max(temp,prod);
        }

        out.println(prod);
        out.flush();
    }
    private static long gcd (long a , long b) {
        if (b == 0) return a;
        return gcd(b,a%b);
    }
    private static int power(int a, int n) {
        int result = 1;
        while (n > 0) {
            if (n % 2 == 0) {
                a = (a * a);
                n /= 2;
            } else {
                result = (result * a);
                n--;
            }
        }
        return result;
    }

    private static int power(int a, int n, int p) {
        int result = 1;
        while (n > 0) {
            if (n % 2 == 0) {
                a = (a * a) % p;
                n /= 2;
            } else {
                result = (result * a) % p;
                n--;
            }
        }
        return result;
    }

    static class Reader {
        private InputStream mIs;
        private byte[] buf = new byte[1024];
        private int curChar, numChars;

        public Reader() {
            this(System.in);
        }

        public Reader(InputStream is) {
            mIs = is;
        }

        public int read() {
            if (numChars == -1) throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = mIs.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public String s() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public long l() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int i() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public double d() throws IOException {
            return Double.parseDouble(s());
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public int[] arr(int n) {
            int[] ret = new int[n];
            for (int i = 0; i < n; i++) {
                ret[i] = i();
            }
            return ret;
        }

        public long[] arrLong(int n) {
            long[] ret = new long[n];
            for (int i = 0; i < n; i++) {
                ret[i] = l();
            }
            return ret;
        }
    }
//    static class pairLong implements Comparator<pairLong> {
//        long first, second;
//
//        pairLong() {
//        }
//
//        pairLong(long first, long second) {
//            this.first = first;
//            this.second = second;
//        }
//
//        @Override
//        public int compare(pairLong p1, pairLong p2) {
//            if (p1.first == p2.first) {
//                if(p1.second > p2.second) return 1;
//                else return -1;
//            }
//            if(p1.first > p2.first) return 1;
//            else return -1;
//        }
//    }
//    static class pair implements Comparator<pair> {
//        int first, second;
//
//        pair() {
//        }
//
//        pair(int first, int second) {
//            this.first = first;
//            this.second = second;
//        }
//
//        @Override
//        public int compare(pair p1, pair p2) {
//            if (p1.first == p2.first) return p1.second - p2.second;
//            return p1.first - p2.first;
//        }
//    }
}

import java.math.BigInteger;
import java.util.Scanner;
import java.lang.Math;
import java.util.StringTokenizer;

public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        if( n== 1){
            System.out.println(1); return;
        }
        if( n== 2){
            System.out.println(2); return;
        }
        if( n== 3){
            System.out.println(6); return;
        }
        if( n== 4){
            System.out.println(12); return;
        }
            long a = n;
           long b = n-1;
            long c = n-2;

            while( !(gcd(a,c) ==1 && gcd(b,c) == 1) ){
                c--;
            }
            long val1 = a*b*c;

            a--; b--;
            c = n-3;

            while( !(gcd(a,c) ==1 && gcd(b,c) == 1) ){
                c--;
            }
             long val2 = a*b*c;
        System.out.println(Math.max(val1,val2));

    }

    public static long gcd(long a, long b){
        if( a<b){
         long temp = a;
         a = b;
         b =temp;
        }

        long x = a; long y = b;
        while(y!=0){
            long r = x % y;
            x = y;
            y = r;
        }

        return x;
    }

}

import java.io.*;
import java.util.*;

public class Program {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;

    static final int MOD = 1000000007;
    static final double INF = 10000000000.0;

	void solve() throws IOException {
		int n;
		n = nextInt();
		if (n == 1)
			out.println(1);
		else if (n == 2)
			out.println(2);
		else if (n % 2 == 1)
		{
			long ans = 1;
			for(long i = n-50; i <= n; i++)
				if (i-2 >= 1)
					ans = Math.max(ans, (i-2) * (i-1) * (i));
			out.println(ans);
		}
		else
		{
			long ans = 1;
			for(long i = n-50; i <= n; i++)
				if (i-3 >= 1)
					if (i % 3 != 0)
						ans = Math.max(ans, (i) * (i-1) * (i-3));
					else
						ans = Math.max(ans, (i-1) * (i-2) * (i-3));
			out.println(ans);
		}

	}

    Program() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Program();
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }

    String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}

/* CodeForces 236 C */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class MaxNok {
	static boolean hascd(long a, long b) {
		if (a<b) return hascd (b,a);
		else if (b==0) return a>1;
		else return hascd(b, a%b);
	}
	public static void main(String[] args) throws IOException {
		BufferedReader bin = new BufferedReader(
				new InputStreamReader(System.in));
		String[] ss = bin.readLine().split(" ");
		int n = Integer.parseInt(ss[0]);
		bin.close();
		long maxNok = 0;
		if (n==1) maxNok = 1;
		else if (n==2) maxNok = 2;
		else if (n == 3) maxNok = 6;
		for (int m = n-2; m>=1 && m>n-20; m--) {
			for (long a=n; a>=m; a--) {
				for (long b=a-1; b>=m; b--) {
					if (!hascd(a,b)) {
						for (long c=b-1; c>=m; c--) {
							if (!hascd(c,a) && !hascd(c,b)) {
								//System.out.printf("a,b,c = %d %d %d\n", a, b, c);
								long mo = a*(b*c);
								//System.out.println("" + mo);
								if (mo > maxNok) {
									maxNok = mo;
									// System.out.printf("maxNok = %d\n", maxNok);
								}
							}
						}

					}
				}
			}
		}
		System.out.println("" + maxNok);
	}

}

import java.io.*;
public class Main
{
    public static void main(String args[]) throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        long res = 0;
        for (long a = Math.max(1, n - 10); a <= n; ++a)
        {
            for (long b = a; b <= n; ++b)
            {
                for (long c = b; c <= n; ++c)
                {
                    long lcm = a / gcd(a, b) * b;
                    lcm = lcm / gcd(lcm, c) * c;
                    res = Math.max(res, lcm);
                }
            }
        }
        System.out.println(res);
    }
    public static long gcd(long a, long b)
    {
        if (b == 0) return a;
        else return (gcd (b, a % b));
    }
}

import java.io.*;
import java.util.*;

public class Q1 {

    static int[][] packU(int n, int[] from, int[] to) {
        int[][] g = new int[n][];
        int[] p = new int[n];
        for (int f : from)
            p[f]++;
        for (int t : to)
            p[t]++;
        for (int i = 0; i < n; i++)
            g[i] = new int[p[i]];
        for (int i = 0; i < from.length; i++) {
            g[from[i]][--p[from[i]]] = to[i];
            g[to[i]][--p[to[i]]] = from[i];
        }
        return g;
    }

    public static void main(String[] args) {

        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        long N = in.nextInt();
        long ans;
        if (N <= 2)
            ans=N;
        else if ((N & 1) == 1)
            ans = N * (N - 1) * (N - 2);
        else {
            if(N%3==0)
               ans =(N-1)*(N-2)*(N-3);
            else
               ans=(N)*(N-1)*(N-3);
        }
        out.println(ans);

        out.close();
}

    static long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }

static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public int[] shuffle(int[] arr) {
        Random r = new Random();
        for (int i = 1, j; i < arr.length; i++) {
            j = r.nextInt(i);
            arr[i] = arr[i] ^ arr[j];
            arr[j] = arr[i] ^ arr[j];
            arr[i] = arr[i] ^ arr[j];
        }
        return arr;
    }

    public InputReader() {
        reader = new BufferedReader(new InputStreamReader(System.in), 32768);
        tokenizer = null;
    }

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(System.in), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public char nextChar() {
        return next().charAt(0);
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

}

}

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int test_cases = 1;
        Solver s = new Solver();
        for (int i = 1; i <= test_cases; i++) {
            s.solve(i, in, out);
        }
        out.close();
    }
}

class Solver {
    static class Pair {
        long lcm, x, y, z;

        public Pair(long l, int xx, int yy, int zz) {
            lcm = l;
            x = xx;
            y = yy;
            z = zz;
        }

    }
    void solve(int test_number, InputReader in, PrintWriter out) throws IOException {
        long n = in.nextInt();
        if (n == 1) {
            out.println(1);
            return;
        }
        if (n == 2) {
            out.println(2);
            return;
        }
        if (n == 3) {
            out.println(6);
            return;
        }
        if (n % 2 == 1) {
            out.println( (n) * (n - 1) * (long) (n - 2));
            return;
        }
        long max = -1;
        ArrayList<Long> v = new ArrayList<>();
        for (long i = Math.max(n - 50, 1); i <= n; i++) {
            v.add(i);
        }
//        ArrayList<Pair> lcm = new ArrayList<>();
        for (long x : v) {
            for (long y : v) {
                for (long z : v) {
//                    if (findLcm(x, y, z) > 1e8) {
//                        out.println(x + " " + y + " " + z + " LCM " + findLcm(x, y, z));
//                        if (!con(lcm, findLcm(x, y, z))) {
//                            lcm.add(new Pair(findLcm(x, y, z), x, y, z));
//                        }
//                    }
                    max = Math.max(findLcm(x, y, z), max);
                }
            }
        }
//        Collections.sort(lcm, new Comparator<Pair>() {
//            @Override
//            public int compare(Pair o1, Pair o2) {
//                return (int) (o1.lcm - o2.lcm);
//            }
//        });
//        for (int i = lcm.size() - 1; i >= lcm.size() - 20; i--) {
//            out.println(lcm.get(i).lcm + " LCM " + " " + lcm.get(i).x + " " + lcm.get(i).y + " " + lcm.get(i).z);
//        }
        out.println(max);
    }

    private boolean con(ArrayList<Pair> lcm, long lcm1) {
        for (int i = 0; i < lcm.size(); i++) {
            if (lcm.get(i).lcm == lcm1) return true;
        }
        return false;
    }

    private long findLcm(long first, long second, long i) {
        long g = first;
        g = (second * g) / (gcd(second, g));
        g = (i * g) / (gcd(i, g));
        return g;
    }

    private long gcd(long a, long b) {
        while (b > 0) {
            long tt = a % b;
            a = b;
            b = tt;
        }
        return a;
    }
}

class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader()
    {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }

    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try
            {
                st = new StringTokenizer(br.readLine());
            }
            catch (IOException  e)
            {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt()
    {
        return Integer.parseInt(next());
    }

    long nextLong()
    {
        return Long.parseLong(next());
    }

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    String nextLine()
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
}

import java.util.HashMap;

import java.util.Scanner;

public class TC
{
    static HashMap<Pair, Long> memo = new HashMap();

    static long gcd( long a, long b ) // assume a>b
    {
        Pair p = new Pair( a, b );
        if ( memo.containsKey( p ) )
            return memo.get( p );

        if( a<b )
            return gcd( b, a );

        else if( b==0 )
            return a;

        else
        {
            long res = gcd( b, a%b) ;
            memo.put( p, res );
            return res;
        }

    }
    static long solve( int n )
    {
        if( n == 1 )
            return 1;

        if( n==2 )
            return 2;

        int cnt1, cnt2, cnt3;

        cnt1 = 0;
        long res = 1;
        for( int i=n; i>=1; i-- )
        {
            cnt1++;
            if( cnt1 >10 )
                break;

            cnt2 = 0;
            for( int j=i-1; j>=1; j-- )
            {
                cnt2++;
                if( cnt2> 10 )
                    break;

                cnt3 = 0;
                for( int k=j-1; k>=1; k-- )
                {
                    cnt3++;
                    if( cnt3 > 10 )
                        break;

                    long res1 = ( long ) j * ( long ) k;
                    long gcd = gcd( j, k );
                    res1 = res1/ gcd;

                    long res2 = res1 * i ;
                    gcd = gcd( res1, i );
                    res2 = res2/gcd;

                    res = Math.max( res, res2 );

                }
            }

        }

        return res;

    }

    public static void main( String[] args ) throws Exception
    {
        Scanner s = new Scanner( System.in );
        int n = s.nextInt();
        long res = solve( n );

        System.out.println( res);

    }

}

class Pair implements Comparable
{
    long first, second; // first -> primary key for sorting/comparison

    public Pair( long _x1, long _x2 )
    {
        first = _x1;
        second = _x2;
    }

    public int compareTo( Object o )
    {
        Pair n = ( Pair ) o ;

        if( first != n.first )
            return ( int ) first- ( int )n.first;

        else
            return ( int )second- ( int )n.second;
    }

    public int hashCode() // Always check for equality after retrieving from hashtable to detect collisions !
    {
        long result = 23;
        result = 31*result + first;
        result = 31*result + second;
        return ( int )result;

    }

    public boolean equals( Object o )
    {
        Pair p = ( Pair ) o;

        if( first == p.first )
            if( second == p.second )
                return true;

        return false;
    }

}

import static java.util.Arrays.deepToString;

import java.io.*;
import java.math.*;
import java.util.*;

import static java.lang.Math.max;

public class A {

	static long gcd(long a, long b) {
		return a == 0 ? b : gcd(b % a, a);
	}

	static long lcm(long... a) {
		long ret = 1;
		for (long v : a) {
			ret *= v / gcd(v, ret);
		}
		return ret;
	}

	static long solve(long n) {
		if (n <= 3)
			return lcm(n, max(1, n - 1), max(1, n - 2));
		long ret = lcm(n, n - 1, n - 2);
		ret = max(ret, lcm(n, n - 2, n - 3));
		ret = max(ret, lcm(n - 1, n - 2, n - 3));
		ret = max(ret, lcm(n, n - 1, n - 3));
		return ret;
	}

	public static void main(String[] args) throws Exception {
		reader = new BufferedReader(new InputStreamReader(System.in));
		writer = new PrintWriter(System.out);
		Locale.setDefault(Locale.US);

		int n = nextInt();
		setTime();
		writer.println(solve(n));
		printTime();
		printMemory();

		writer.close();
	}

	static BufferedReader reader;
	static PrintWriter writer;
	static StringTokenizer tok = new StringTokenizer("");
	static long systemTime;

	static void debug(Object... o) {
		System.err.println(deepToString(o));
	}

	static void setTime() {
		systemTime = System.currentTimeMillis();
	}

	static void printTime() {
		System.err.println("Time consumed: " + (System.currentTimeMillis() - systemTime));
	}

	static void printMemory() {
		System.err.println("Memory consumed: " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1000 + "kb");
	}

	static String next() {
		while (!tok.hasMoreTokens()) {
			String w = null;
			try {
				w = reader.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			if (w == null)
				return null;
			tok = new StringTokenizer(w);
		}
		return tok.nextToken();
	}

	static int nextInt() {
		return Integer.parseInt(next());
	}

	static long nextLong() {
		return Long.parseLong(next());
	}

	static double nextDouble() {
		return Double.parseDouble(next());
	}

	static BigInteger nextBigInteger() {
		return new BigInteger(next());
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Vaibhav Mittal
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
	public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.readInt();
        long res = 0;
        for (int i = Math.max(1, n - 100); i <= n; ++i)
            for (int j = i; j <= n; ++j)
                for (int k = j; k <= n; ++k)
                    res = Math.max(res, lcm(i, lcm(j, k)));
        out.println(res);
    }

    private long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    private long lcm(long a, long b) {
        return (a / gcd(a, b)) * b;
    }
}

class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
}

import java.io.*;
import java.util.*;

public class main{
    public static void main(String args[]){
        Solver s=new Solver();
        s.run();
    }
}
class FastReader {
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public FastReader() {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public FastReader(String file_name) throws IOException{
        din = new DataInputStream(new FileInputStream(file_name));
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String nextLine() {
        try{
            byte[] buf = new byte[10000]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }catch (Exception e){
            System.out.println(e.getMessage());
            return null;
        }
    }

    public int nextInt()  {
        int ret = 0;
        try {
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do{
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        } catch (Exception e) {
            System.out.println(e.getMessage());
                return -1;
            }
        }

    public long nextLong()   {
        try {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        } catch (Exception e) {
            System.out.println(e.getMessage());
            return -1;
        }
    }

    public double nextDouble()  {
        try {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }
            if (neg) return -ret;
            return ret;
        } catch (Exception e) {
            System.out.println(e.getMessage());
            return -1;
        }
    }

    private void fillBuffer() throws IOException{
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1)
            buffer[0] = -1;
    }

    private byte read() throws IOException  {
        try{
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
            }catch(Exception e){
                System.out.println(e.getMessage());
                return -1;
            }
        }

    public void close() throws IOException {
        if (din == null)
            return;
        din.close();
    }
}
/////

class Solver {
    StringBuilder out=new StringBuilder(100);
    FastReader in=new FastReader();
    public long pow(long a, long b){
        long ans=1;
        while(b>0){
            if(b%2==1){
                ans*=a;
            }
            a*=a;
            b/=2;
        }
        return ans;
    }
    public int[] getIntArray(int n){
        int arr[]=new int[n];
        for(int i=0;i<n;i++){
            arr[i]=in.nextInt();
        }
        return arr;
    }
    public int gcd(int a, int b){
        if(a==0)return b;
        return gcd(b%a, a);
    }
    public void solve(){
        int n=in.nextInt();
        if(n==1){
            out.append(1);
            return;
        }else if(n==2){
            out.append(2);
            return;
        }
        long ans=1;
        if(n%2!=0){
            ans=n--;ans*=n--;ans*=n--;
            out.append(ans);
            return;
        }
        // System.out.println(gcd(n, n-3));
        if(gcd(n, n-3)==1){
            ans*=n;
            ans*=(n-1);
            ans*=(n-3);
        }else{
            ans*=(n-1);
            ans*=(n-2);
            ans*=(n-3);
        }
        out.append(ans);

    }
    public void run(){
        int t=1;
        for(int i=0;i<t;i++){
            solve();
            out.append('\n');
        }
        System.out.println(out);
    }
}

    // class FastReader {
    //     BufferedReader br;
    //     StringTokenizer st;

    //     public FastReader() {
    //         br = new BufferedReader(new InputStreamReader(System.in));
    //     }

    //     String next() {
    //         while (st == null || !st.hasMoreElements()) {
    //             try {
    //                 st = new StringTokenizer(br.readLine());
    //             } catch (IOException e) {
    //                 e.printStackTrace();
    //             }
    //         }
    //         return st.nextToken();
    //     }

    //     int nextInt() {
    //         return Integer.parseInt(next());
    //     }

    //     long nextLong() {
    //         return Long.parseLong(next());
    //     }

    //     double nextDouble() {
    //         return Double.parseDouble(next());
    //     }

    //     String nextLine() {
    //         String str = "";
    //         try {
    //             str = br.readLine();
    //         } catch (IOException e) {
    //             e.printStackTrace();
    //         }
    //         return str;
    //     }
    // }

import java.util.*;
import java.math.*;
import java.io.*;
public class Main{static int  m;
static BigInteger w;
static String h;
    public static void main(String[] args)  throws IOException {
        input.init(System.in);
        PrintWriter out = new PrintWriter(System.out);
        long z= input.nextLong();
        long b,c;
        long max=0;
        for(long a=z;a>=1;a--){
        b=a;

        while(gcd(b,a)>1&&b>1)
            b--;
        c=b;
        while((gcd(c,a)>1||gcd(c,b)>1)&&c>1)
            c--;
        max=Math.max(a*b*c,max);
        }
        System.out.println(max);
    }

    public static long gcd(long x,long y){
        if(x%y==0)
            return y;
        else
            return gcd(y,x%y);
    }

    public static class input {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
}
}

import java.io.*;
import java.util.*;

public class CFRound146TaskA {
	FastScanner in;
	PrintWriter out;

	long gcd(long x, long y) {
		if (y == 0)
			return x;
		return gcd(y, x % y);
	}

	long lcm(long x, long y) {
		return x / gcd(x, y) * y;
	}

	long solve2(int n) {
		long ans = 1;
		for (int i = n - 50; i <= n; i++)
			for (int j = n - 50; j <= n; j++)
				for (int k = n - 50; k <= n; k++) {
					if (i < 1 || j < 1 || k < 1)
						continue;
					long ans2 = lcm(lcm(i, j), k);
					ans = Math.max(ans, ans2);
				}
		return ans;
	}

	void solve() {
		out.println(solve2(in.nextInt()));
	}

	void run() {
		try {
			in = new FastScanner(new File("object.in"));
			out = new PrintWriter(new File("object.out"));

			solve();

			out.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	void runIO() {

		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] args) {
		new CFRound146TaskA().runIO();
	}
}

import java.util.Scanner;

public class c236 {

	public static void main(String args[]){

		Scanner in = new Scanner(System.in);
		long n=in.nextInt();
		if(n>2){
		if(n%2==0)
		{
			long max= (n-1)*(n-2)*(n-3);

				long x=n*(n-1)*(n-3);
				if(n%3==0)
					x/=3;
				if(x>max)
					max=x;

			System.out.println(max);

		}

		else
			System.out.println((n)*(n-1)*(n-2));
	}
		else
			System.out.println(n);

	}

}

import java.io.*;
import java.util.*;
public class Solution{

                 static long solve(long n){

                         long ans=0;
                         for(long i=n;i>=Math.max(3,n-50);i--){
                                long lcm=0;
                                if(i%2==1) lcm = (i*(i-1)*(i-2));
                                else lcm = (i*(i-1)*(i-2))/2;
                                 if(ans<lcm) ans=lcm;
                          }
                     return(ans);
                 }

                 public static void main(String[] args){

                      int n = intt();
                      if(n==1) out.println("1");
                      else if(n==2) out.println("2");
                      else if(n==3) out.println("6");
                      else  out.println(solve(n));

                      out.flush();
              }
                static FastReader sc=new FastReader();
                static PrintWriter out = new PrintWriter(System.out);
                static int mod=1000000007;

                static int intt(){
                       int x = sc.nextInt();
                       return(x);
                }
               static long longg(){
                          long x = sc.nextLong();
                           return(x);
                }
               static double doublee(){
                          double t = sc.nextDouble();
                           return(t);
                }
              static String str(){
                       String s = sc.next();
                         return(s);
                }
              static String strln(){

                        String s = sc.nextLine();
                           return(s);
              }
              static long pow(long a,long b){
                       long ans=1;
                      while(b>0){
                          if(b%2==1)
                              ans=(ans*a);
                              a=(a*a)%mod;
                              b=b/2;
                      }
                    return(ans);
                }
             static long GCD(long a,long b){
                           if(b%a==0)
                               return(a);
                               return(GCD(b%a,a));
              }
            static long LCM(long a,long b){
                         return ((a*b)/GCD(a,b));
               }
              static long Fermat(long a,long p){
                           long b = p-2,ans=1;
                            while(b>0){
                                 if(b%2==1)
                                      ans=(ans*a)%p;
                                       a=(a*a)%p;
                                       b=b/2;
                              }
                           return(ans);
                   }
              static void Fact(long a[],long m){
                              a[0]=1;
                           for(int i=1;i<a.length;i++)
                                   a[i]=(i*a[i-1])%m;

                      }
              static void Fact_Inv(long a[],long F[],long m){

                                 int n =a.length;
                                     a[n-1]=Fermat(F[n-1],m);
                                 for(int i=n-2;i>=0;i--)
                                        a[i]=((i+1)*a[i+1])%m;
                        }
               /*static  long d, x, y;
              static void extendedEuclid(long A, long B) {
                            if(B == 0) {
                                  d = A;
                                  x = 1;
                                  y = 0;
                              }
                           else {
                                extendedEuclid(B, A%B);
                                 long temp = x;
                                  x = y;
                                 y = temp - (A/B)*y;
                            }
                     } */
                 /*static class pair implements Comparable<pair>{
                       int x,y;
                      pair(int a,int b){
                             x=a;
                             y=b;
                       }
                     public int compareTo(pair p1)
                           { return((p1.x-p1.y)-(this.x-this.y));}

                   public boolean equals(Object obj) {
                         if (this == obj)
                                return true;
                        if (obj == null)
                                return false;
                        if (getClass() != obj.getClass())
                                return false;
                         pair other = (pair) obj;
                          if (x != other.x)
                                  return false;
                          if (y != other.y)
                                  return false;
                            return true;
                      }
                      @Override
                 public int hashCode() {
                      return(x-y);
                   }
          }   */

      static void addEdge(LinkedList<Integer> adjList[],int s,int d){
                             adjList[s].add(d);
                             adjList[d].add(s);
              }
       static int abs(char x,char y)
                   { return(Math.abs(x-y));}
        static long min(long x,long y){
                     return(Math.min(x,y));
                 }
        static long max(long a,long b){
                        return Math.max(a,b);
                  }
         static boolean correct(int n){
                          if((n&(n+1))==0)
                              return(true);
                              return(false);
                  }
           static class pair{
                        int val;
                        int l,level,bit ; // l=-1; if not any level is flipped
                        pair(int v,int L,int j,int b){
                               val = v;
                               l =L;
                               level = j;
                                bit=b;
                        }
            }
         static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.util.*;
public class Lcmchallenge1
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		if(n==1 || n==2)
			System.out.println(n);
		else
		{
			if(n%2==0)
				if(n%3==0)
					System.out.println((n-1)*(n-2)*(n-3));
				else
					System.out.println((n)*(n-1)*(n-3));
			else
				System.out.println((n)*(n-1)*(n-2));
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class LCMchallenge {

	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner(System.in);
		long n=sc.nextInt();
		System.out.println(n*Math.max(1L, n-1)*Math.max(1L, n-2));

	}
	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

		public boolean ready() throws IOException {return br.ready();}

	}
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//package codeforcespractice;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author admin
 */
public class CodeforcesPractice {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        long n=Integer.parseInt(br.readLine());
        long ans;

        if(n%2!=0){
        ans=n*(n-1)*(n-2);
        }
        else{
                if(n%3!=0){
                ans=Math.max((n*(n-1)*(n-2))/2,n*(n-1)*(n-3));
                }
                else{
                ans=Math.max((n*(n-1)*(n-2))/2,(n-1)*(n-2)*(n-3));
                }
        }
        System.out.println(ans);
    }
}

import java.io.*;
import java.math.*;
public class Main
{
    public static void main(String args[]) throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int T=Integer.parseInt(br.readLine());
        BigInteger N1 = new BigInteger(Integer.toString(T));
        BigInteger N2 = new BigInteger(Integer.toString(T-1));
        BigInteger N3 = new BigInteger(Integer.toString(T-2));
        System.out.println(N1);
        System.out.println(N2);
        System.out.println(N3);

        if(T==2)System.out.println("2");
        else if(T>=1 && (T-1)>=1 && (T-2)>=1)
        {
            N1=(N1.multiply(N2)).divide((N1.gcd(N2)));
            System.out.println((N1.multiply(N3)).divide((N1.gcd(N3))));
        }

        else System.out.println("1");
    }
}

import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        // Largest LCM from 3 numbers <= n.
        // An LCM is a number that can divide both numbers.
        if (n <= 3) {
            int res = 1;

            for (int i = 1; i <= n; i++) {
                res *= i;
            }

            System.out.println(res);
        }
        else if (n % 2 == 0) {
            BigInteger b = new BigInteger("1");

            b = b.multiply(new BigInteger(Integer.toString(n)));
            b = b.multiply(new BigInteger(Integer.toString(n-1)));
            b = b.multiply(new BigInteger(Integer.toString(n-3)));

            System.out.println(b.toString());
        }
        else {
            BigInteger b = new BigInteger("1");

            b = b.multiply(new BigInteger(Integer.toString(n)));
            b = b.multiply(new BigInteger(Integer.toString(n-1)));
            b = b.multiply(new BigInteger(Integer.toString(n-2)));

            System.out.println(b.toString());
        }
    }
}

import java.io.IOException;

import java.util.StringTokenizer;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeSet;
import java.util.*;

public class  Main {

    static String s=new String();
    public static void main(String[]args)
    {

        FastReader in=new FastReader();

        int n=in.nextInt();

        if(n==1)
        System.out.println(1);
        else{
        if(n==2)
            System.out.println(2);
        else
        {
            int a=n;

            int b=n-1;

            int c=n-2;

            if(n%2>0)
            {
                System.out.println(a*b*c);
            }

            else
            {
                int m1=gcd(a,b);

                int m2=gcd(a,c);

                int m3=gcd(b,c);

                if(m1==1 && m2==1 && m3==1)
                {
                    System.out.println(a*b*c);
                }
                else
                {

                    a=n-1;
                    b=n-2;
                    c=n-3;

                    int a2=n;

                    int b2=n-1;

                    int c2=n-3;

                    if(gcd(a2,b2)==1 && gcd(a2,c2)==1 && gcd(b2,c2)==1 && ((long)a2*b2*c2) > ((long)a*b*c))
                        System.out.println((long)a2*b2*c2);
                    else
                    System.out.println((long)a*b*c);
                }
            }
        }
        }

    }

    public static int gcd(int a,int b)
    {
        if(b==0)
            return a;

        else
            return gcd(b,a%b);
    }

}

//method for prime numbers

/*public static boolean sieve(int n) {
    boolean[]x=new boolean[n+1];
    for(int i = 0; i <= n;++i) {
        x[i] = true;
    }
    x[0] = false;
    x[1] = false;
    for(int i = 2; i * i <= n; ++i) {
         if(x[i] == true) {
             // Mark all the multiples of i as composite numbers
             for(int j = i * i; j <= n ;j += i)
                 x[j] = false;
        }
    }

    int i=0;

    int count=0;
    while(i<x.length)
    {
        if(x[i] && n%i==0)
            count++;

        i++;
    }

    return (count==3)?true:false;*/

/* monk is birthday treat

int n=in.nextInt();

       int t=in.nextInt();

       s=new List[n];

       for(int r=0;r<s.length;r++)
       {
           s[r]=new ArrayList();
       }

       while(t-->0)
       {
           int a=in.nextInt()-1;

           int b=in.nextInt()-1;
           s[a].add(b);
       }

       long[]p=new long[n];

       for(int i=0;i<s.length;i++)
       {

          Stack<Integer>e=new Stack();
          int[]k=new int[s[i].size()];
          int j=0;
          if(!s[i].isEmpty()){

              boolean []x=new boolean[n];

           for (Integer h : s[i]) {
               int count=0;

               e.add(h);

               if(!x[h]){
               x[h]=true;
               count++;
               }
               while(!e.isEmpty())
               {
                   int u=e.pop();

                   for (Integer v : s[u]) {
                       if(!x[v])
                       {
                           x[v]=true;
                           count++;
                           e.add(v);
                       }

                   }

               }

               k[j]=count;
               j++;

           }
        Arrays.sort(k);

        int q=0;
        while(q<k.length)
        {
            if(k[q]!=0)
            {
                p[i]=k[q];
                break;
            }
            q++;
        }

          }
       }
        Arrays.sort(p);
        int y=0;
        long count2=0;
        while(y<p.length)
        {
           if(p[y]!=0)
           {
              count2=p[y];
              break;
           }

           y++;
        }
        System.out.println(count2);

*/

/*class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
}*/

class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
}

import java.util.Scanner;

public class LCM {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();

        if (n <= 2)
            System.out.println(n);
        else if (n % 2 == 1)
            System.out.println(n * (n - 1) * (n - 2));
        else {
            int max = 0;
            for (int i = n; i > n - 50; i--) {
                max = Math.max(max, lcm(i, i - 1, i - 2));
            }
            System.out.println(max);
        }
    }

    public static int lcm(int a, int b, int c) {
        return lcm(lcm(a, b), c);
    }

    public static int lcm(int a, int b) {
        return a * b / gcd(a, b);
    }

    public static int gcd(int a, int b) {
        if (b == 0) return a;
        else return gcd(b, a % b);
    }
}

import java.util.Scanner;
import java.util.TreeSet;

public class LCMChallenge
{

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		long n = sc.nextInt();

		long a = n;
		TreeSet<Long> factors = new TreeSet<Long>();
		for(long i = 2; i*i <= a; i++)
		{
			if(a%i == 0)
			{
				factors.add(i);
				a /= i;
				i--;
			}
		}

		int found = 0;
		long r = n;
		for(long i = n-1; i >= 1 && found < 2; i--)
		{
			boolean flag = false;
			long num = i;
			for(long d : factors)
			{
				if(num%d == 0)
				{
					flag = true;
					break;
				}
			}

			if(!flag)
			{
				found++;
				r *= i;
//				System.out.println(i);
			}

		}
		//out of n -> the rest is 1
//		System.out.println(factors);
		System.out.println(r);

	}

}

import java.util.*;
import java.io.*;
public class a {
  static long mod = 1000000000l;
public static void main(String[] args) throws IOException
{
  input.init(System.in);
  PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
  long n = input.nextInt();
  //out.println(n<3?n:( n%2==0?(n==4?12:(n-3)*(n-1)*(n) ):n*(n-1)*(n-2)));
  if(n<3) out.println(n);
  else if(n==4) out.println(12);
  else if(n==6) out.println(60);
  else if(n%2 != 0) out.println(n*(n-1)*(n-2));
  else if(n%3 != 0) out.println(n*(n-1)*(n-3));
  else if(n%5 != 0) out.println((n-1)*(n-2)*(n-3));
  else if(n%7 != 0) out.println(n*(n-1)*(n-7));
  else if(n%11 != 0) out.println(n*(n-1)*(n-11));
  else if(n%13 != 0) out.println(n*(n-1)*(n-13));
  else if(n%17 != 0) out.println(n*(n-1)*(n-17));
  else out.println(n*(n-1)*(n-19));

  out.close();

}
static class input {
  static BufferedReader reader;
  static StringTokenizer tokenizer;

  /** call this method to initialize reader for InputStream */
  static void init(InputStream input) {
      reader = new BufferedReader(
                   new InputStreamReader(input) );
      tokenizer = new StringTokenizer("");
  }

  /** get next word */
  static String next() throws IOException {
      while ( ! tokenizer.hasMoreTokens() ) {
          //TODO add check for eof if necessary
          tokenizer = new StringTokenizer(
                 reader.readLine() );
      }
      return tokenizer.nextToken();
  }

  static int nextInt() throws IOException {
      return Integer.parseInt( next() );
  }

  static double nextDouble() throws IOException {
      return Double.parseDouble( next() );
  }
  static String nextLine() throws IOException {
    return reader.readLine();
  }
}
}

import java.util.*;
import java.io.*;
import java.math.BigInteger;
/*
8 6

46
 */
public class b
{
	public static void main(String[] arg) throws Exception
	{
		new b();
	}

	public b() throws Exception
	{
		FastScanner in = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
//		for(int n = 1; n <= 50; n++)
//		{
//			long best = 0;
//			int idx1 = 0;
//			int idx2 = 0;
//			int idx3 = 0;
//			for(int i = 1; i <= n; i++)
//			{
//				for(int j = 1; j <= n; j++)
//				{
//					for(int k = 1; k <= n; k++)
//					{
//						int sum = lcm(lcm(i, j), k);
//						if(sum > best)
//						{
//							best = sum;
//							idx1 = i;
//							idx2 = j;
//							idx3 = k;
//						}
//					}
//				}
//			}
//			System.out.println(n + " : " + best + " " + idx1 + " " + idx2 + " " + idx3);
//		}
//		long n = in.nextLong();
//		if(n == 1) System.out.println(1);
//		else System.out.println(n*n*(n-1));
		long n = in.nextLong();
		if(n == 1)
		{
			System.out.println(1);
		}
		else if(n == 2)
		{
			System.out.println(2);
		}
		else if(n== 6)
		{
			System.out.println(60);
		}
		else
		{
			if(n%2 == 1)
			{
				System.out.println(n*(n-1)*(n-2));
			}
			else
			{
				long best = 0;
				for(long a = n; a >= Math.max(4, n-50); a--)
					for(long b = n; b >= Math.max(4, n-50); b--)
						for(long c = n; c >= Math.max(4, n-50); c--)
					best = Math.max(best, lcm(a, b, c));
				System.out.println(best);
			}
		}
		in.close(); out.close();
	}
	long lcm(long a, long b, long c)
	{
		return lcm(lcm(a, b), c);
	}
	long lcm(long a, long b)
	{
		return a*b/gcd(a, b);
	}
	long gcd(long a, long b)
	{
		return b==0?a:gcd(b, a%b);
	}
	class FastScanner
	{
		BufferedReader br;
		StringTokenizer st;
		public FastScanner(InputStream in)
		{
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer("");
		}
		public String next() throws IOException
		{
			while(!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException
		{
			return Integer.parseInt(next());
		}
		public void close() throws IOException
		{
			br.close();
		}
		public long nextLong() throws IOException
		{
			return Long.parseLong(next());
		}
		public double nextDouble() throws IOException
		{
			return Double.parseDouble(next());
		}
	}
}

import java.util.*;
import java.io.*;
public class a {
  static long mod = 1000000000l;
public static void main(String[] args) throws IOException
{
  input.init(System.in);
  PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
  int n = input.nextInt();
  out.println(n<3?n:(long)n*(n-1)*(n-2));

  out.close();

}
static class input {
  static BufferedReader reader;
  static StringTokenizer tokenizer;

  /** call this method to initialize reader for InputStream */
  static void init(InputStream input) {
      reader = new BufferedReader(
                   new InputStreamReader(input) );
      tokenizer = new StringTokenizer("");
  }

  /** get next word */
  static String next() throws IOException {
      while ( ! tokenizer.hasMoreTokens() ) {
          //TODO add check for eof if necessary
          tokenizer = new StringTokenizer(
                 reader.readLine() );
      }
      return tokenizer.nextToken();
  }

  static int nextInt() throws IOException {
      return Integer.parseInt( next() );
  }

  static double nextDouble() throws IOException {
      return Double.parseDouble( next() );
  }
  static String nextLine() throws IOException {
    return reader.readLine();
  }
}
}

//package CF;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt();
		if(n == 1) out.println(1);
		else{
			sieve(n);
			int gPr = primes.get(primes.size()-1), f = n, s = n-1;
			while(gPr == f) f--;
			s = f-1;
			while(gPr == s) s--;
			out.println(1l*f*s*gPr);
		}
		out.flush();
		out.close();
	}
	static ArrayList<Integer> primes;
	static int[] isComposite;

	static void sieve(int N)	// O(N log log N)
	{
		isComposite = new int[N+1];
		isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if(1l * i * i <= N)
					for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
						isComposite[j] = 1;
			}
	}
	static class Scanner {
		BufferedReader bf;
		StringTokenizer st;

		public Scanner(InputStream i) {
			bf = new BufferedReader(new InputStreamReader(i));

		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(bf.readLine());
			return st.nextToken();
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}
	}
}

import java.util.*;
import java.io.*;
import java.lang.*;
public class A235 {
	private static long mod = 1000000007;

	public static void main(String[] args) {
		InputReader in=new InputReader(System.in);
		PrintWriter pw=new PrintWriter(System.out);

		int n=in.nextInt();

		if(n<=2) pw.print(n);
		else {
			if(n%2==1)
				pw.println(n*(n-1)*(n-2));
			else {
				long ans=(n-1)*(n-2)*(n-3);
				long lcm;

				for(long i=Math.max(n-50,1);i<=n-2 && i>=1;i++) {
					for(long j=i+1;j<=n-1 && j>=1;j++) {
						for(long k=i+2;k>=1 && k<=n;k++) {
							lcm=LCM(j, k);
							lcm=LCM(lcm,i);

							if(ans<lcm) ans=lcm;
						}
					}
				}

				pw.println(ans);
			}
		}

		pw.flush();
		pw.close();
	}

	static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		public String readString() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}

	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}

	public static ArrayList<Integer> primeFactorization(int n)
	{
		ArrayList<Integer> a =new ArrayList<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}

	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;

		isPrime[0] = false;
		isPrime[1] = false;

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}

	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static boolean isPrime(int n)
	{

	    if (n <= 1)  return false;
	    if (n <= 3)  return true;

	    if (n%2 == 0 || n%3 == 0)
	    	return false;

	    for (int i=5; i*i<=n; i=i+6)
	    {
	        if (n%i == 0 || n%(i+2) == 0)
	           return false;
	    }

	    return true;
	}

	static class pair implements Comparable<pair>
	{
		Integer x, y;
		pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);

			return result;
		}
	}
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);

        int n=in.nextInt();

        if(n<=2)
            System.out.println(2);
        else
        {
            int a=n;

            int b=n-1;

            int c=n-2;

            if(n%2>0)
            {
                System.out.println(a*b*c);
            }
            else
            {
                int m1=gcd(a,b);

                int m2=gcd(a,c);

                int m3=gcd(b,c);

                if(m1==1 && m2==1 && m3==1)
                {
                    System.out.println(a*b*c);
                }
                else
                {
                    a=n-1;
                    b=n-2;
                    c=n-3;
                    System.out.println(a*b*c);
                }
            }
        }

    }

    public static int gcd(int a,int b)
    {
        if(b==0)
            return a;

        else
            return gcd(b,a%b);
    }
}

import java.util.*;
import java.io.*;
public class CF235A {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int n = sc.nextInt();

      long ans = n * (n - 1) * (n - 2);
      if(n == 1)
         ans = 1;
      if(n == 2)
         ans = 2;
      System.out.println(ans);
   }
}

import java.util.*;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Scanner;
public class CopyOfGCD
{
	 static Scanner sc=new Scanner(System.in);
	 static PrintWriter out=new PrintWriter(System.out);
	 static void pn(Object o)
	 {
	 out.println(o);
	 out.flush();

	 }
	 static void p(Object o)
	 {
	 out.print(o);
	 out.flush();
	 }
	 static void pni(Object o)
	 {
	 out.println(o);System.out.flush();
	 }

	 static int I() throws IOException
	 {
	 return sc.nextInt();
	 }
	 static long L()throws IOException
	 {
	 return sc.nextLong();
	 }
	 static double D()throws IOException
	 {
	 return sc.nextDouble();
	 }
	 static String S()throws IOException
	    {
	        return sc.next();
	     }
	 static char C() throws IOException
	 {
	     return sc.next().charAt(0);
	 }

	   static int[] Ai (int n) throws IOException {
			int[] arr = new int[n];

			for(int i = 0; i < n; i++) arr[i] = I();

			return arr;
		}
	  static String[] As(int n) throws IOException {
			String s[] = new String[n];

			for(int i = 0; i < n; i++) s[i] = S();

			return s;
		}
	   static long[] Al (int n) throws IOException {
			long[] arr = new long[n];

			for(int i = 0; i < n; i++) arr[i] = L();

			return arr;
		}
	   public static int gcd(int a, int b)
	    {
	        if (a == 0)
	            return b;

	        return gcd(b%a, a);
	    }
		static void process() throws IOException
	{
			int n=I();long max1=0;long max2=0;
			if(n==1)
			{
			    pn(1);
			 }
			 else
			 if(n==2)
			 {
			     pn(2);
			 }
			 else
			 {
			    for(int i=0;i<n;i++)
			{
			    if(i>n-2)
			    {
			        break;
			     }
				if(gcd(i,i+1)==1 && gcd(i+1,i+2)==1 && gcd(i+2,i)==1)
				{

					max2=Math.max(max1, (i*(i+1)*(i+2)));
			    }

			}
			  for(int i=1;i<n;i++)
			  {
			      if(gcd(i,n-1)==1 && gcd(i,n)==1)
			      {
			         max1=Math.max(max1, (i*(n)*(n-1)));
			     }
			 }
			 pn(Math.max(max1,max2));
              }
            }
		public static void main(String[] args) throws IOException
		{
			process();
		}
}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.awt.Point;

// SHIVAM GUPTA :
//NSIT
//decoder_1671
//BEING PERFECTIONIST IS NOT AN OPTION.
// STOP NOT TILL IT IS DONE OR U DIE .
//EITHER MAKE IT OR BREAK IT.
//NEVER UNDERESTIMATE URSELF.
// U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U
// REST ..HAVE FAITH ON DESTINY

// ASCII = 48 + i ;

// 2^28 = 268,435,456  > 10^8

// log 10 base 2 = 3.3219

// odd:: (x^2+1)/2 , (x^2-1)/2 ; x>=3

// even:: (x^2/4)+1 ,(x^2/4)-1  x >=4

/* Name of the class has to be "Main" only if the class is public. */

public class Main
{

    // static int[] arr = new int[100002] ;
    // static int[] dp = new int[100002] ;

     static PrintWriter out;

	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br=new BufferedReader(new InputStreamReader(System.in));
			out=new PrintWriter(System.out);
		}
		String next(){
			while(st==null || !st.hasMoreElements()){
				try{
					st= new StringTokenizer(br.readLine());
				}
				catch (IOException e){
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		String nextLine(){
			String str = "";
			try{
				str=br.readLine();
			}
			catch(IOException e){
				e.printStackTrace();
			}
			return str;
		}
	}

////////////////////////////////////////////////////////////////////////////////////
 public static int countDigit(long n)
    {
        return (int)Math.floor(Math.log10(n) + 1);
    }

/////////////////////////////////////////////////////////////////////////////////////////

 public static int sumOfDigits(long n)
 {

  if( n< 0)return -1 ;

  int sum = 0;

  while( n > 0)
  {
      sum = sum + (int)( n %10) ;

      n /= 10 ;
  }

  return sum ;

 }

 //////////////////////////////////////////////////////////////////////////////////////////////////

public static long arraySum(int[] arr , int start , int end)
{
    long ans = 0 ;

    for(int i = start ; i <= end  ; i++)ans += arr[i] ;

    return ans  ;
}

/////////////////////////////////////////////////////////////////////////////////

public static int mod(int x)
{
      if(x <0)return -1*x ;
      else return x ;
}
public static long mod(long x)
{
      if(x <0)return -1*x ;
      else return x ;
}

////////////////////////////////////////////////////////////////////////////////

public static void swapArray(int[] arr , int start , int end)
{
    while(start < end)
    {
        int temp = arr[start] ;
        arr[start] = arr[end];
        arr[end] = temp;
        start++ ;end-- ;
    }
}

//////////////////////////////////////////////////////////////////////////////////

public static int[][] rotate(int[][] input){

int n =input.length;
int m = input[0].length ;
int[][] output = new int [m][n];

for (int i=0; i<n; i++)
	for (int j=0;j<m; j++)
		output [j][n-1-i] = input[i][j];
return output;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////

public static int countBits(long n)
    {
        int count = 0;
        while (n != 0)
        {
            count++;
            n = (n) >> (1L) ;
        }

        return count;

    }
/////////////////////////////////////////// ////////////////////////////////////////////////

public static boolean isPowerOfTwo(long n)
{
    if(n==0)
    return false;

if(((n ) & (n-1)) == 0 ) return true ;
else return false  ;

}

/////////////////////////////////////////////////////////////////////////////////////

public static int  min(int a ,int b , int c, int d)
{
     int[] arr = new int[4] ;
      arr[0] = a;arr[1] = b ;arr[2] = c;arr[3] = d;Arrays.sort(arr) ;

       return arr[0];
}
 /////////////////////////////////////////////////////////////////////////////
public static int  max(int a ,int b , int c, int d)
{
     int[] arr = new int[4] ;
      arr[0] = a;arr[1] = b ;arr[2] = c;arr[3] = d;Arrays.sort(arr) ;

       return arr[3];
}

///////////////////////////////////////////////////////////////////////////////////

public static String reverse(String input)
{
   StringBuilder str  = new StringBuilder("") ;

    for(int i =input.length()-1 ; i >= 0  ; i-- )
    {
        str.append(input.charAt(i));
    }

return str.toString() ;
}
///////////////////////////////////////////////////////////////////////////////////////////

public static boolean sameParity(long a  ,long b )
{
      if(a %2 ==0 && b % 2 == 0)return true ;
      else return false  ;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
public static boolean isPossibleTriangle(int a  ,int b , int c)
{
      if( a + b > c && c+b > a && a +c > b)return true  ;
      else return false  ;
}

////////////////////////////////////////////////////////////////////////////////////////////

public static int gcd(int a, int b )
{

if(b==0)return a ;

else return gcd(b,a%b) ;

}

public static long gcd(long a, long b )
{

if(b==0)return a ;

else return gcd(b,a%b) ;

}

////////////////////////////////////////////////////////////////////////////////////

public static int lcm(int a, int b ,int c , int d )
{

int temp = lcm(a,b , c) ;

 int ans = lcm(temp ,d ) ;

return ans  ;

}

///////////////////////////////////////////////////////////////////////////////////////////

public static int lcm(int a, int b ,int c )
{

int temp = lcm(a,b) ;

int ans =  lcm(temp ,c) ;

return ans  ;

}

////////////////////////////////////////////////////////////////////////////////////////

public static int lcm(int a , int b )
{

int gc = gcd(a,b);

return (a*b)/gc ;
}

///////////////////////////////////////////////////////////////////////////////////////////
static boolean isPrime(long n)
{
      if(n==1)
      {
            return false  ;
      }

      boolean ans =  true  ;

      for(long i = 2L; i*i <= n ;i++)
      {
            if(n% i ==0)
            {
                  ans = false  ;break ;
            }
      }

      return ans  ;
}
///////////////////////////////////////////////////////////////////////////

static int sieve =  1000000 ;

static boolean[] prime =  new boolean[sieve + 1] ;

public static void sieveOfEratosthenes()
    {
        // FALSE == prime

        // TRUE ==  COMPOSITE

        // FALSE== 1

        // time complexity = 0(NlogLogN)== o(N)

        // gives prime nos bw 1 to N

        for(int i = 4; i<= sieve ; i++)
        {
            prime[i] = true  ;
            i++ ;
        }

        for(int p = 3; p*p <= sieve; p++)
        {

            if(prime[p] == false)
            {

                for(int i = p*p; i <= sieve; i += p)
                    prime[i] = true;
            }

            p++ ;
        }

    }

///////////////////////////////////////////////////////////////////////////////////

public static void sortD(int[] arr , int s  , int e)
{
      sort(arr ,s , e) ;

      int i =s ; int j = e  ;

      while( i < j)
      {
            int temp = arr[i] ;
            arr[i] =arr[j] ;
            arr[j] = temp ;
            i++ ; j-- ;
      }

      return ;
}

/////////////////////////////////////////////////////////////////////////////////////////

public static long countSubarraysSumToK(long[] arr ,long sum )
    {
      HashMap<Long,Long> map = new HashMap<>() ;

      int n = arr.length ;

      long prefixsum = 0 ;

      long count = 0L ;
      for(int i  = 0; i < n ; i++)
      {
          prefixsum  = prefixsum +  arr[i] ;

          if(sum == prefixsum)count = count+1 ;

          if(map.containsKey(prefixsum -sum))
          {
              count = count + map.get(prefixsum -sum) ;
          }

          if(map.containsKey(prefixsum ))
          {
              map.put(prefixsum , map.get(prefixsum) +1 );
          }

          else{
              map.put(prefixsum , 1L );
          }

      }

      return count  ;

    }

///////////////////////////////////////////////////////////////////////////////////////////////

 // CALCULATE TOTIENT Fn FOR ALL VALUES FROM 1 TO n
    // TOTIENT(N) = count of nos less than n and grater than 1 whose gcd with n is 1
    // or n and the no  will be coprime in nature
    //time : O(n*(log(logn)))

    public static void eulerTotientFunction(int[] arr ,int n )
    {

      for(int i = 1; i <= n  ;i++)arr[i] =i  ;

      for(int i= 2 ; i<= n ;i++)
      {
          if(arr[i] == i)
          {
              arr[i] =i-1 ;

              for(int j =2*i ; j<= n  ; j+= i )
              {
                  arr[j] = (arr[j]*(i-1))/i ;
              }

          }
      }

      return  ;

    }

/////////////////////////////////////////////////////////////////////////////////////////////
public static long nCr(int n,int k)
{
    long ans=1;
    k=k>n-k?n-k:k;
    int j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}

///////////////////////////////////////////////////////////////////////////////////////////

public static ArrayList<Integer> allFactors(int n)
{
      ArrayList<Integer> list = new ArrayList<>() ;

    for(int i = 1; i*i <= n ;i++)
    {
          if( n % i == 0)
          {
              if(i*i == n)
              {
                    list.add(i) ;
              }
              else{
                    list.add(i) ;
                    list.add(n/i) ;

              }
          }
    }

     return list ;

}

public static ArrayList<Long> allFactors(long n)
{
      ArrayList<Long> list = new ArrayList<>() ;

    for(long i = 1L; i*i <= n ;i++)
    {
          if( n % i == 0)
          {
              if(i*i == n)
              {
                    list.add(i) ;
              }
              else{
                    list.add(i) ;
                    list.add(n/i) ;

              }
          }
    }

     return list ;

}
////////////////////////////////////////////////////////////////////////////////////////////////////

  static final int MAXN = 100001;

    static int spf[] = new int[MAXN];

    static void sieve()
    {
        spf[1] = 1;
        for (int i=2; i<MAXN; i++)

            spf[i] = i;

        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;

        for (int i=3; i*i<MAXN; i++)
        {

            if (spf[i] == i)
            {

                for (int j=i*i; j<MAXN; j+=i)

                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }

// The above code works well for n upto the order of 10^7.
// Beyond this we will face memory issues.

// Time Complexity: The precomputation for smallest prime factor is done in O(n log log n)
// using sieve.
// Where as in the calculation step we are dividing the number every time by
// the smallest prime number till it becomes 1.
// So, let’s consider a worst case in which every time the SPF is 2 .
// Therefore will have log n division steps.

// Hence, We can say that our Time Complexity will be O(log n) in worst case.

    static Vector<Integer> getFactorization(int x)
    {
        Vector<Integer> ret = new Vector<>();
        while (x != 1)
        {
            ret.add(spf[x]);
            x = x / spf[x];
        }
        return ret;
    }

 //////////////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////////////

public static void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int[n1];
        int R[] = new int[n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
  public static void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

public static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

public static void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long[n1];
        long R[] = new long[n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

 /////////////////////////////////////////////////////////////////////////////////////////

	public static long knapsack(int[] weight,long value[],int maxWeight){

        int n=  value.length ;

	//dp[i] stores the profit with KnapSack capacity "i"
  long []dp = new long[maxWeight+1];

    //initially profit with 0 to W KnapSack capacity is 0
    Arrays.fill(dp, 0);

    // iterate through all items
    for(int i=0; i < n; i++)

        //traverse dp array from right to left
        for(int j = maxWeight; j >= weight[i]; j--)
            dp[j] = Math.max(dp[j] , value[i] + dp[j - weight[i]]);

    /*above line finds out maximum of dp[j](excluding ith element value)
    and val[i] + dp[j-wt[i]] (including ith element value and the
    profit with "KnapSack capacity - ith element weight") */
    return dp[maxWeight];
	}

///////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////

// to return max sum of any subarray in given array
public static long kadanesAlgorithm(long[] arr)
{
      long[] dp = new long[arr.length] ;

      dp[0] = arr[0] ;
      long max =  dp[0] ;

      for(int i = 1; i <  arr.length ; i++)
      {
            if(dp[i-1] > 0)
            {
                  dp[i] = dp[i-1] + arr[i] ;
            }
            else{
                  dp[i] = arr[i] ;
            }

            if(dp[i] >  max)max = dp[i] ;

      }

      return max  ;

}
/////////////////////////////////////////////////////////////////////////////////////////////
public static long kadanesAlgorithm(int[] arr)
{
      long[] dp = new long[arr.length] ;

      dp[0] = arr[0] ;
      long max =  dp[0] ;

      for(int i = 1; i <  arr.length ; i++)
      {
            if(dp[i-1] > 0)
            {
                  dp[i] = dp[i-1] + arr[i] ;
            }
            else{
                  dp[i] = arr[i] ;
            }

            if(dp[i] >  max)max = dp[i] ;

      }

      return max  ;

}

///////////////////////////////////////////////////////////////////////////////////////

// Arrays.sort(arr, new Comparator<Pair>() {
// 			@Override
// 			public int compare(Pair first, Pa second) {
// 				if (first.getAge() != second.getAge()) {
// 					return first.getAge() - second.getAge();
// 				}
// 				return first.getName().compareTo(second.getName());
// 			}
// 		});

/////////////////////////////////////////////////////////////////////////////////////////

public static long binarySerachGreater(int[] arr , int start , int end , int val)
{

      // fing total no of elements strictly grater than val in sorted array arr

      if(start >  end)return  0 ; //Base case

      int mid = (start + end)/2  ;

      if(arr[mid] <=val)
      {
          return binarySerachGreater(arr,mid+1, end ,val) ;

      }
      else{

         return binarySerachGreater(arr,start , mid -1,val) + end-mid+1 ;

      }

}

//////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////

//TO GENERATE ALL(DUPLICATE ALSO EXIST) PERMUTATIONS OF A STRING

// JUST CALL generatePermutation( str,  start,  end) start :inclusive ,end : exclusive

//Function for swapping the characters at position I with character at position j
    public static String swapString(String a, int i, int j) {
        char[] b =a.toCharArray();
        char ch;
        ch = b[i];
        b[i] = b[j];
        b[j] = ch;
        return String.valueOf(b);
    }

//Function for generating different permutations of the string
    public static void generatePermutation(String str, int start, int end)
    {
        //Prints the permutations
        if (start == end-1)
            System.out.println(str);
        else
        {
            for (int i = start; i < end; i++)
            {
                //Swapping the string by fixing a character
                str = swapString(str,start,i);
                //Recursively calling function generatePermutation() for rest of the characters
                generatePermutation(str,start+1,end);
                //Backtracking and swapping the characters again.
                str = swapString(str,start,i);
            }
        }
    }

////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////

public static long factMod(long n, long mod) {
    if (n <= 1) return 1;
    long ans = 1;
    for (int i = 1; i <= n; i++) {
      ans = (ans * i) % mod;
    }
    return ans;
  }

/////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////

public static long power(int x  ,int n)
    {
        //time comp : o(logn)

        if(n==0)return 1 ;
        if(n==1)return x;

        long ans =1L  ;

      while(n>0)
      {
          if(n % 2 ==1)
          {
              ans = ans *x ;
          }

          n /= 2 ;

          x =  x*x ;

      }

      return ans ;
    }

////////////////////////////////////////////////////////////////////////////////////////////////////
public static long powerMod(long x, long n, long mod) {
    //time comp : o(logn)

    if(n==0)return 1L ;
        if(n==1)return x;

    long ans = 1;
    while (n > 0) {
      if (n % 2 == 1) ans = (ans * x) % mod;
      x = (x * x) % mod;
      n /= 2;
    }
    return ans;
  }

//////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////

/*
lowerBound - finds largest element equal or less than value paased
upperBound - finds smallest element equal or more than value passed

if not present return -1;

*/

public static long lowerBound(long[] arr,long k)
	{
		long ans=-1;

		int start=0;
		int end=arr.length-1;

		while(start<=end)
		{
			int mid=(start+end)/2;

			if(arr[mid]<=k)
			{
				ans=arr[mid];
				start=mid+1;
			}
			else
			{
				end=mid-1;
			}

		}

		return ans;

	}

	public static int lowerBound(int[] arr,int k)
	{
		int ans=-1;

		int start=0;
		int end=arr.length-1;

		while(start<=end)
		{
			int mid=(start+end)/2;

			if(arr[mid]<=k)
			{
				ans=arr[mid];
				start=mid+1;
			}
			else
			{
				end=mid-1;
			}

		}

		return ans;

	}

	public static long upperBound(long[] arr,long k)
	{
		long ans=-1;

		int start=0;
		int end=arr.length-1;

		while(start<=end)
		{
			int mid=(start+end)/2;

			if(arr[mid]>=k)
			{
				ans=arr[mid];
				end=mid-1;
			}
			else
			{
				start=mid+1;
			}

		}

		return ans;
	}

	public static int upperBound(int[] arr,int k)
	{
		int ans=-1;

		int start=0;
		int end=arr.length-1;

		while(start<=end)
		{
			int mid=(start+end)/2;

			if(arr[mid]>=k)
			{
				ans=arr[mid];
				end=mid-1;
			}
			else
			{
				start=mid+1;
			}

		}

		return ans;
	}

//////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////

public static void solve()
{
FastReader scn = new FastReader() ;

//int[] store = {2 ,3, 5 , 7  ,11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 } ;

// product of first 11 prime nos is gre ater than 10 ^ 12;

//ArrayList<Integer> list = new ArrayList<>() ;
ArrayList<Long> list = new ArrayList<>() ;
ArrayList<Integer> lista = new ArrayList<>() ;
ArrayList<Integer> listb = new ArrayList<>() ;

//HashMap<Integer,Integer> map = new HashMap<>() ;
HashMap<Long,Integer> map = new HashMap<>() ;
HashMap<Integer,Integer> map1  = new HashMap<>() ;
HashMap<Integer,Integer> map2  = new HashMap<>() ;
//HashMap<String,Integer> maps = new HashMap<>() ;
//HashMap<Integer,Boolean> mapb = new HashMap<>() ;
//HashMap<Point,Integer> point = new HashMap<>() ;

Set<Integer> set = new HashSet<>() ;
Set<Integer> setx = new HashSet<>() ;
Set<Integer> sety = new HashSet<>() ;

//if(map.containsKey(arr[i]))map.put(arr[i] , map.get(arr[i]) +1 ) ;
//else map.put(arr[i],1) ;

// if(map.containsKey(temp))map.put(temp , map.get(temp) +1 ) ;
// else map.put(temp,1) ;

//int bit  =Integer.bitCount(n);
// gives total no of set bits in n;

int t = 1;
// t = scn.nextInt() ;

while(t-- > 0)
{

 //String str  = scn.next() ;
 long n = scn.nextLong() ;
  //long k = scn.nextLong() ;
  //long a = scn.nextLong() ;
  //long b = scn.nextLong() ;

 //int n = scn.nextInt() ;
 //int m = scn.nextInt() ;
 // int x  = scn.nextInt() ;
// int y = scn.nextInt() ;
//int k = scn.nextInt() ;
//int a = scn.nextInt() ;
//int c = scn.nextInt() ;
// int d = scn.nextInt() ;
//int b = scn.nextInt() ;

if( n ==1)out.println(1) ;

else if( n==2)out.println(2);

else if( n==3)out.println(6) ;

else if( n% 2L ==1)
{

    out.print(n*(n-1)*(n-2)) ;

}

else{

    long opt1 = (n*(n-1)*(n-2))/2L ;

    long opt2 = (n*(n-1)*(n-3)) ;

    if(opt1 > opt2)
    {
        out.print(opt1) ;
    }

    else{
        out.print(opt2) ;
    }
}

//for(int i = 0; i < n; i++)out.print(arr[i]+ " ") ;

// for(int i = 0; i < arr.length ; i++)
//  {
//      for(int j = 0; j < arr[0].length ; j ++)
//      {
//          out.print(arr[i][j] +" ");
//      }
//      out.println() ;
//   }

//out.println() ;

list.clear() ;
map.clear() ;
map1.clear() ;
map2.clear() ;
set.clear() ;
} // test case  end loop

out.flush() ;
}

public static void main (String[] args) throws java.lang.Exception
{

solve() ;

}

}

 class Pair
{
  int first ;

  int second  ;

@Override
	public String toString() {

	String ans = "" ;
	ans  += this.first ;
	ans += " ";
	ans += this.second ;

	return ans  ;
	}

}

import java.util.*;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Scanner;
public class CopyOfGCD
{
	 static Scanner sc=new Scanner(System.in);
	 static PrintWriter out=new PrintWriter(System.out);
	 static void pn(Object o)
	 {
	 out.println(o);
	 out.flush();

	 }
	 static void p(Object o)
	 {
	 out.print(o);
	 out.flush();
	 }
	 static void pni(Object o)
	 {
	 out.println(o);System.out.flush();
	 }

	 static int I() throws IOException
	 {
	 return sc.nextInt();
	 }
	 static long L()throws IOException
	 {
	 return sc.nextLong();
	 }
	 static double D()throws IOException
	 {
	 return sc.nextDouble();
	 }
	 static String S()throws IOException
	    {
	        return sc.next();
	     }
	 static char C() throws IOException
	 {
	     return sc.next().charAt(0);
	 }

	   static int[] Ai (int n) throws IOException {
			int[] arr = new int[n];

			for(int i = 0; i < n; i++) arr[i] = I();

			return arr;
		}
	  static String[] As(int n) throws IOException {
			String s[] = new String[n];

			for(int i = 0; i < n; i++) s[i] = S();

			return s;
		}
	   static long[] Al (int n) throws IOException {
			long[] arr = new long[n];

			for(int i = 0; i < n; i++) arr[i] = L();

			return arr;
		}
	   public static int gcd(int a, int b)
	    {
	        if (a == 0)
	            return b;

	        return gcd(b%a, a);
	    }
		static void process() throws IOException
	{
			int n=I();long max1=0;
			if(n==1)
			{
			    pn(1);
			 }
			 else
			 if(n==2)
			 {
			     pn(2);
			 }
			 else
			 {

			  for(int i=1;i<n;i++)
			  {
			      if(gcd(i,n-1)==1 && gcd(i,n)==1)
			      {
			         max1=Math.max(max1, (i*(n)*(n-1)));
			     }
			 }
			 pn(max1);
              }
            }
		public static void main(String[] args) throws IOException
		{
			process();
		}
}

import java.io.*;
import java.util.*;
public class Hello{
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	Scanner in=new Scanner(System.in);

	void seive(boolean[] arr){
		int n=arr.length;
		for(int i=2;i*i<=n;i++){
			if(arr[i]){
				for(int j=2*i;j<n;j+=i){
					arr[j]=false;
				}
			}
		}
	}
	long LCM(boolean[] arr,int n){
		if(n<=2)
			return n;
		if(n<=4)
			return n*(n-1);
		long res=(long)n*(n-1);
		int i=n-2;
		while(i>1){
			if(arr[i]==true && n%i!=0 && (n-1)%i!=0){
				break;
			}
			i--;
		}
		//out.println(i+" "+res);
		res=(long)i*res;
		return res;
	}

	public void solve(){
		int n=ni();
		boolean[] arr=new boolean[n];
		Arrays.fill(arr,true);
		seive(arr);
		//int[] res=new int[n+1];
		long max=Integer.MIN_VALUE;
		for(int i=1;i<=n;i++){
			max=Math.max(LCM(arr,i),max);
		}
		out.println(max);
	}
	void run(){
		is = new DataInputStream(System.in);
		out = new PrintWriter(System.out);
		int t=1;while(t-->0)solve();
		out.flush();
	}
	public static void main(String[] args)throws Exception{new Hello().run();}
	//Fast I/O code is copied from uwi code.
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	private int readByte(){
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }
	private String ns(){
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	private char[] ns(int n){
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	private char[][] nm(int n, int m){
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	private int[] na(int n){
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	private int ni(){
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	private long nl(){
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	static  int i(long x){return (int)Math.round(x);}
	static int i(double x){return (int)Math.round(x);}
	static class Pair implements Comparable<Pair>{
		long fs,sc;
		Pair(long a,long b){
			fs=a;sc=b;
		}
		public int compareTo(Pair p){
			if(this.fs>p.fs)return 1;
			else if(this.fs<p.fs)return -1;
			else{
				return i(this.sc-p.sc);
			}
			//return i(this.sc-p.sc);
		}
		public String toString(){
			return "("+fs+","+sc+")";
		}
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class C146 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int i = n;
        long mx = 1;
        while(i >= 1) {
            int j = i;
            while(j >= 1) {
                if(gcd(j, i) == 1) {
                    int k = j;
                    if(i * j * k < mx) break;
                    while(k >= 1) {
                        if(gcd(k, j) == 1 && gcd(i, k) == 1) {
                            mx = Math.max(mx, (long)i * j * k);
                            break;
                        }
                        k--;
                    }
                }
                j--;
            }
            i--;
        }
        System.out.println(mx);
    }
    public static long gcd(long a, long b) {
        if(a == 0) return b;
        return gcd(b % a, a);
    }
}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
	public static Scanner scan = new Scanner(System.in);
	public static boolean bg = true;

	public static void main(String[] args) throws Exception {
		long n1 = Integer.parseInt(scan.next());
		if (n1==1){
			System.out.println(1);
			System.exit(0);
		}
		if (n1==2){
			System.out.println(2);
			System.exit(0);
		}
		if (n1==3){
			System.out.println(6);
			System.exit(0);
		}
		if (n1%2==0){
			n1-=1;
			n1 = n1*(n1-1)*(n1-2);
			System.out.println(n1);
		}
		else {
			n1 = n1*(n1-1)*(n1-2);
			System.out.println(n1);
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Scanner;

public class C {
    static InputStreamReader in = new InputStreamReader(System.in);
    static BufferedReader bf = new BufferedReader(in);
    static StreamTokenizer st = new StreamTokenizer(bf);
    static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws IOException{
        int n = nextInt();
        long ans = 1;
        for (int i = 1; i <= n-2; i++) {
            ans = Math.max(ans, (long)i*(long)(i+1)*(long)(i+2)/(gcd(i,i+1)*gcd(i,i+2)*gcd(i+1,i+2)));
        }
        System.out.println(ans);
    }
    private static long gcd(long a, long b) {
        return (b == 0)?a:gcd(b,a%b);
    }
    private static int nextInt() throws IOException{
        st.nextToken();
        return (int) st.nval;
    }
}

import static java.lang.Math.*;
import java.io.*;
import java.util.*;

public class A {
	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(in.readLine());
			} catch(Exception e) {}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}

	boolean bit(int m, int i) {
		return (m & (1 << i)) > 0;
	}

	void db(String ss){
		System.err.println(ss);
	}

	long gcd(long a, long b) {
		return b==0 ? a : gcd(b, a % b);
	}

	long lcm(long a, long b, long c) {
		a = a * b;
		long d = gcd(a,c);
		return a*c/d;
	}

	public void run() {
		in  = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
			int n = nextInt();
			if (n == 1) out.println(1); else {
				Long ans = 0L;
				for (int i=1; i<=n; i++) ans = max(ans, lcm(n,n-1,i));
				out.println(ans);
			}
		out.close();
	}

	class Pair implements Comparable<Pair> {
		int x,y;
		public Pair(int x, int y) {
			this.x=x;
			this.y=y;
		}
		public int compareTo(Pair o) {
			if (x != o.x) return x - o.x;
			return o.y - y;
		}
	}

	int sign(long x) {
		if (x < 0) return -1;
		if (x > 0) return 1;
		return 0;
	}

	public static void main(String[] args) throws Exception {
		new A().run();
	}
}

import java.io.*;
import java.util.*;
public final class lcm_challenge
{
    static FastScanner sc=new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out=new PrintWriter(System.out);
	static List<Long> list=new ArrayList<Long>();
	static int[] arr;
	static int maxn=1000001;

	static void mark(int num,int max)
	{
		int elem,i=2;
		while((elem=(num*i))<=max)
		{
			arr[elem-1]=1;
			i++;
		}
	}

	static void build()
	{
		arr=new int[maxn];
		for(int i=1;i<arr.length-1;i++)
		{
			if(arr[i]==0)
			{
				list.add((long)(i+1));
				mark(i+1,arr.length-1);
			}
		}
	}

	static long gcd(long a,long b)
	{
		if(b==0)
			return a;
		else
			return gcd(b,a%b);
	}

	public static void main(String args[]) throws Exception
	{
		long n=sc.nextInt();
		if(n<=4)
		{
			int val;
			if(n==1)
			{
				val=1;
			}
			else if(n==2)
			{
				val=2;
			}
			else if(n==3)
			{
				val=3;
			}
			else
			{
				val=12;
			}
			out.println(val);
		}
		else
		{
			if(n%2!=0)
			{
				long val1=n*(n-1)*(n-2);
				out.println(val1);
			}
			else
			{
				//build();
				long max1=(n-1)*(n-2)*(n-3);
				long num1=n,num2=n-1,max2=-1;
				for(long i=n-2;i>=1;i--)
				{
					if(gcd(i,num2)!=1)
					{
						long curr1=(num2*i)/gcd(i,num2);
						long curr2=num1*curr1;
						max2=Math.max(max2,curr2);
					}
					else if(gcd(i,num1)!=1)
					{
						long curr1=(num1*i)/gcd(num1,i);
						long curr2=num2*curr1;
						max2=Math.max(curr2,max2);
					}
					else
					{
						long curr=num1*num2*i;
						max2=Math.max(max2,curr);
					}
				}
				out.println(Math.max(max1,max2));
			}
		}
		out.close();
	}
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

	public String next() throws Exception {
		return nextToken().toString();
	}

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class CodeC
{
	static class Scanner
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String nextLine()
		{
			try { return br.readLine(); } catch(Exception e) { throw new RuntimeException(e); }
		}

		String next()
		{
			while(!st.hasMoreTokens())
			{
				String line = nextLine();
				if(line == null) return null;
				st = new StringTokenizer(line);
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		private double nextDouble()
		{
			return Double.parseDouble(next());
		}

		int[] nextIntArray(int n)
		{
			int[] nA = new int[n];
			for(int i = 0; i < n; i++)
				nA[i] = nextInt();
			return nA;
		}

		Integer[] nextIntegerArray(int n)
		{
			Integer[] nA = new Integer[n];
			for(int i = 0; i < n; i++)
				nA[i] = nextInt();
			return nA;
		}

		long[] nextLongArray(int n)
		{
			long[] nA = new long[n];
			for(int i = 0; i < n; i++)
				nA[i] = nextLong();
			return nA;
		}

		Long[] nextLongOArray(int n)
		{
			Long[] nA = new Long[n];
			for(int i = 0; i < n; i++)
				nA[i] = nextLong();
			return nA;
		}

		double[] nextDoubleArray(int n)
		{
			double[] nA = new double[n];
			for(int i = 0; i < n; i++)
				nA[i] = nextDouble();
			return nA;
		}

		Double[] nextDoubleOArray(int n)
		{
			Double[] nA = new Double[n];
			for(int i = 0; i < n; i++)
				nA[i] = nextDouble();
			return nA;
		}

		String[] nextStringArray(int n)
		{
			String[] nA = new String[n];
			for(int i = 0; i < n; i++)
				nA[i] = next();
			return nA;
		}
	}

	static long buscar(int a)
	{
		long mejor = 0;
		int b = a - 1;
		while(true)
		{
			while(a > 0 && (gcd(a, b) != 1))
				b--;
			int c = b - 1;
			while(c > 0 && (gcd(a, c) != 1 || gcd(b, c) != 1))
				c--;
			long num = a;
			num *= b;
			num *= c;
			if(num <= mejor)
				return mejor;
			else
				mejor = num;
		}
	}

	private static int gcd(int a, int b)
	{
		if(b == 0)
			return a;
		return gcd(b, a % b);
	}
	public static void main(String[] args)
	{

		Scanner sc = new Scanner();
		long mejor = 0;
		int n = sc.nextInt();
		for(int i = 1; i <= n; i++)
			mejor = Math.max(mejor, buscar(i));
		System.out.println(mejor);
	}

}

import java.math.BigInteger;
import java.util.* ;

public class P1
{
public static void main(String args[]){
    Scanner input=new Scanner(System.in);
    int n=input.nextInt();
    if(n>2){
        System.out.println(lcm(lcm(n,n-1),n-2));
    }else{
        if(n==1)
            System.out.println("1");
        else System.out.println("2");
    }

        }
private static long lcm(long a, long b)
{
    return a * (b / gcd(a, b));
}
private static long gcd(long a, long b)
{
    while (b > 0)
    {
        long temp = b;
        b = a % b; // % is remainder
        a = temp;
    }
    return a;
}
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long res= 1;
		if(n<=2){
			res=n;
		}
		else if(n%2!=0)
			res= (n-2) * (n-1) * n;
		else{
			if(n%3==0){
				res = (n-1)* (n-2) * (n-3);
			}
			else
				res = (n-3) * (n-1) * n;
		}
		System.out.println(res);
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Nasko
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {

            int N = in.nextInt();

            if (N == 1) {
                out.println(1);
            } else if (N == 2) {
                out.println(2);
            } else if (N == 3) {
                out.println(6);
            } else {

                long best = Long.MIN_VALUE;
                for (long i = N; i >= 2; --i) {
                    best = Math.max(best, lcm(N, lcm(N - 1, i)));
                }
                for (long i = N - 1; i >= 2; --i) {
                    best = Math.max(best, lcm(N, lcm(N - 1, i)));
                }
                out.println(best);
            }
        }

        private long lcm(long a, long b) {
            return a * (b / gcd(a, b));
        }

        private long gcd(long a, long b) {
            return b == 0 ? a : gcd(b, a % b);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

//package codeforces;

import java.io.*;
import java.util.*;

public final class LCMChallenge
{
    public static void main(String[] args)
    {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);

        Solver solver = new Solver(in, out);
        solver.solve();

        out.flush();

        in.close();
        out.close();
    }

    static class Solver
    {
        int n;
        List<Integer> primes;
        InputReader in;
        OutputWriter out;

        void solve()
        {
            long n = in.nextInt();

            if (n % 2 == 1)
                out.println(n * (n - 1) * (n - 2));
            else
                out.println(n * (n - 1) * (n - 3));
        }

        void solve3()
        {
            n = in.nextInt();
            findPrimes(n + 5);

            if (n == 1)
            {
                out.println(1);

                return;
            }
            else if (n == 2)
            {
                out.println(2);

                return;
            }

            List<Integer> check = new ArrayList<>();

            check.add(n);
            check.add(n - 1);
            check.add(n - 2);

            int index = Collections.binarySearch(primes, n);

            if (index < 0)
            {
                index++;
                index *= -1;
                index--;

                if (index >= 0)
                {
                    check.add(primes.get(index));

                    if (index > 0)
                        check.add(primes.get(index - 1));

                    if (index > 1)
                        check.add(primes.get(index - 2));
                }
            }
            else
            {
                if (index > 0)
                    check.add(primes.get(index - 1));

                if (index > 1)
                    check.add(primes.get(index - 2));
            }

            int size = check.size();
            long max = 1;

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    for (int k = 0; k < size; k++)
                    {
                        long a = check.get(i);
                        long b = check.get(j);
                        long c = check.get(k);

                        max = Math.max(max, CMath.lcm(a, b, c));
                    }
                }
            }

            out.println(max);
        }

        void solve2()
        {
            n = in.nextInt();
            findPrimes(n + 5);

            if (n == 1)
            {
                out.println(1);

                return;
            }
            else if (n == 2)
            {
                out.println(2);

                return;
            }

            long a = CMath.lcm(n, n - 1, n - 2);
            long b = 0;
            long c;
            int index = Collections.binarySearch(primes, n - 2);

            if (index < 0)
            {
                index++;
                index *= -1;
                index--;

                if (index > 0)
                    b = CMath.lcm(n, n - 1, primes.get(index));
            }

            index = Collections.binarySearch(primes, n - 1);

            if (index < 0)
            {
                index++;
                index *= -1;
                index--;

                if (index > 0)
                {
                    c = primes.get(index);
                    c *= (index > 0 ? primes.get(index - 1) : 1);
                    c *= (index > 1 ? primes.get(index - 2) : 1);
                }
                else
                    c = 1;
            }
            else
                c = primes.get(index);

            out.println(Math.max(a, Math.max(b, c)));
        }

        void findPrimes(int limit)
        {
            primes = new ArrayList<>();
            primes.add(2);

            boolean[] isComp = new boolean[limit];
            int counter = 2;

            while ((counter << 1) < limit)
            {
                isComp[counter << 1] = true;
                counter++;
            }

            for (int i = 3; i < limit; i += 2)
            {
                if (isComp[i])
                    continue;

                primes.add(i);

                int curr = i + i;

                while (curr < limit)
                {
                    isComp[curr] = true;
                    curr += i;
                }
            }
        }

        public Solver(InputReader in, OutputWriter out)
        {
            this.in = in;
            this.out = out;
        }

    }

    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c & 15;

                c = read();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public int[] nextIntArray(int arraySize)
        {
            int array[] = new int[arraySize];

            for (int i = 0; i < arraySize; i++)
                array[i] = nextInt();

            return array;
        }

        public long nextLong()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sign = 1;

            if (c == '-')
            {
                sign = -1;

                c = read();
            }

            long result = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                result *= 10;
                result += c & 15;

                c = read();
            } while (!isSpaceChar(c));

            return result * sign;
        }

        public long[] nextLongArray(int arraySize)
        {
            long array[] = new long[arraySize];

            for (int i = 0; i < arraySize; i++)
                array[i] = nextLong();

            return array;
        }

        public float nextFloat() // problematic
        {
            float result, div;
            byte c;

            result = 0;
            div = 1;
            c = (byte) read();

            while (c <= ' ')
                c = (byte) read();

            boolean isNegative = (c == '-');

            if (isNegative)
                c = (byte) read();

            do
            {
                result = result * 10 + c - '0';
            } while ((c = (byte) read()) >= '0' && c <= '9');

            if (c == '.')
                while ((c = (byte) read()) >= '0' && c <= '9')
                    result += (c - '0') / (div *= 10);

            if (isNegative)
                return -result;

            return result;
        }

        public double nextDouble() // not completely accurate
        {
            double ret = 0, div = 1;
            byte c = (byte) read();

            while (c <= ' ')
                c = (byte) read();

            boolean neg = (c == '-');

            if (neg)
                c = (byte) read();

            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = (byte) read()) >= '0' && c <= '9');

            if (c == '.')
                while ((c = (byte) read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);

            if (neg)
                return -ret;

            return ret;
        }

        public String next()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do
            {
                res.appendCodePoint(c);

                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String nextLine()
        {
            int c = read();

            StringBuilder result = new StringBuilder();

            do
            {
                result.appendCodePoint(c);

                c = read();
            } while (!isNewLine(c));

            return result.toString();
        }

        public boolean isNewLine(int c)
        {
            return c == '\n';
        }

        public void close()
        {
            try
            {
                stream.close();
            } catch (IOException e)
            {
                e.printStackTrace();
            }
        }

    }

    static class OutputWriter
    {
        private PrintWriter writer;

        public OutputWriter(OutputStream stream)
        {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
                    stream)));
        }

        public OutputWriter(Writer writer)
        {
            this.writer = new PrintWriter(writer);
        }

        public void println(int x)
        {
            writer.println(x);
        }

        public void print(int x)
        {
            writer.print(x);
        }

        public void println(char x)
        {
            writer.println(x);
        }

        public void print(char x)
        {
            writer.print(x);
        }

        public void println(int array[], int size)
        {
            for (int i = 0; i < size; i++)
                println(array[i]);
        }

        public void print(int array[], int size)
        {
            for (int i = 0; i < size; i++)
                print(array[i] + " ");
        }

        public void println(long x)
        {
            writer.println(x);
        }

        public void print(long x)
        {
            writer.print(x);
        }

        public void println(long array[], int size)
        {
            for (int i = 0; i < size; i++)
                println(array[i]);
        }

        public void print(long array[], int size)
        {
            for (int i = 0; i < size; i++)
                print(array[i]);
        }

        public void println(float num)
        {
            writer.println(num);
        }

        public void print(float num)
        {
            writer.print(num);
        }

        public void println(double num)
        {
            writer.println(num);
        }

        public void print(double num)
        {
            writer.print(num);
        }

        public void println(String s)
        {
            writer.println(s);
        }

        public void print(String s)
        {
            writer.print(s);
        }

        public void println()
        {
            writer.println();
        }

        public void printSpace()
        {
            writer.print(" ");
        }

        public void printf(String format, Object args)
        {
            writer.printf(format, args);
        }

        public void flush()
        {
            writer.flush();
        }

        public void close()
        {
            writer.close();
        }

    }

    static class CMath
    {
        static long gcd(long a, long b)
        {
            if (b == 0)
                return a;

            return gcd(b, a % b);
        }

        static long lcm(long... arr)
        {
            int len = arr.length;
            long lcm = arr[0];

            for (int i = 1; i < len; i++)
                lcm = (lcm * arr[i]) / gcd(lcm, arr[i]);

            return lcm;
        }

    }

}

import java.util.*;
import java.io.*;
import java.math.*;
public class loser
{
    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

        public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }
    }
    static class card{
        int l;
        int r;
        public card(int ch,int i)
        {
            this.l=ch;
            this.r=i;
        }
    }
    static class sort implements Comparator<card>
    {
        public int compare(card o1,card o2)
        {
            if(o1.l!=o2.l)
                return (int)(o1.l-o2.l);
            else
                return (int)(o1.r-o2.r);
        }
    }
    static void shuffle(long a[])
    {
        List<Long> l=new ArrayList<>();
        for(int i=0;i<a.length;i++)
            l.add(a[i]);
        Collections.shuffle(l);
        for(int i=0;i<a.length;i++)
            a[i]=l.get(i);
    }

    static long gcd(long a,long b)
    {
    if(b==0)
    return a;
    else
    return gcd(b,a%b);
    }
    /*static int ans1=Integer.MAX_VALUE,ans2=Integer.MAX_VALUE,ans3=Integer.MAX_VALUE,ans4=Integer.MAX_VALUE;
    static boolean v[]=new boolean[101];
    static void dfs(Integer so,Set<Integer> s[]){
    if(!v[so.intValue()])
    {
    v[so]=true;
    for(Integer h:s[so.intValue()])
    {
    if(!v[h.intValue()])
    dfs(h,s);
    }
    }
    }
    static class Print{
    public PrintWriter out;
    Print(OutputStream o)
    {
    out=new PrintWriter(o);
    }
    }
    static int CeilIndex(int A[], int l, int r, int key)
    {
    while (r - l > 1) {
    int m = l + (r - l) / 2;
    if (A[m] >= key)
    r = m;
    else
    l = m;
    }

    return r;
    }

    static int LongestIncreasingSubsequenceLength(int A[], int size)
    {
    // Add boundary case, when array size is one
    int[] tailTable = new int[size];
    int len; // always points empty slot
    tailTable[0] = A[0];
    len = 1;
    for (int i = 1; i < size; i++) {
    if (A[i] < tailTable[0])
    // new smallest value
    tailTable[0] = A[i];

    else if (A[i] > tailTable[len - 1])
    // A[i] wants to extend largest subsequence
    tailTable[len++] = A[i];

    else
    // A[i] wants to be current end candidate of an existing
    // subsequence. It will replace ceil value in tailTable
    tailTable[CeilIndex(tailTable, -1, len - 1, A[i])] = A[i];
    }
    return len;
    }*/
    /*static int binary(int n)
    {
    int s=1;
    while(n>0)
    {
    s=s<<1;
    n--;
    }
    return s-1;
    }
    static StringBuilder bin(int i,int n)
    {
    StringBuilder s=new StringBuilder();
    while(i>0)
    {
    s.append(i%2);
    i=i/2;
    }
    while(s.length()!=n)
    {
    s.append(0);
    }
    return s.reverse();
    }*/
    /*static boolean v[]=new boolean[1000006];
    static void seive()
    {
        for(int i=2;i<1000006;i++)
        {
            if(v[i]==false)
            {
                for(int j=2*i;j<1000006;j+=i)
                {
                    v[j]=true;
                }
            }
        }
    }*/
    public  static void main(String[] args)
    {
        InputReader sc=new InputReader(System.in);
        int n=sc.nextInt();
        if(n<3)
        {
            System.out.println(n);
            System.exit(0);
        }
        else if(n%2==0)
        {
            System.out.println(n*(n-1)*(n-3));
            System.exit(0);
        }
        else if(n%6==0)
        {
            System.out.println((n-1)*(n-2)*(n-3));
            System.exit(0);
        }
        else
        System.out.println(n*(n-1)*(n-2));
    }
}

import java.io.*;
import java.util.*;

public class lcm {
	static int n;

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		//BufferedReader in = new BufferedReader(new FileReader("lcm.in"));
		n = Integer.parseInt(in.readLine());
		System.out.println(lcm(n));
		in.close();
	}

	static long lcm(int n) {
		if (n == 1) return 1;
		if (n == 2) return 2;

		if (n%2 == 0) {
			long ans = n-1;
			ans *= n-2;
			ans *= n-3;
			return ans;
		}

		// n is odd
		long ans = n;
		ans *= n-1;
		ans *= n-2;
		return ans;
	}
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int x = input.nextInt();
long l;
if(x==1||x==2){l=x;

}
else if(x%2==0&&x>2&&x%3!=0){
    l=(x)*(x-1)*(x-3);
}else if(x%2==0&&x%3==0){
    l=x*(x-1)*(x-4);
}

else {l=x*(x-1)*(x-2);}
System.out.println(l);
    }
}

/*
 * Remember a 7.0 student can know more than a 10.0 student.
 * Grades don't determine intelligence, they test obedience.
 * I Never Give Up.
 */
import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.text.*;

import static java.lang.System.out;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class ContestMain {
	private static Reader in=new Reader();
	private static StringBuilder ans=new StringBuilder();
	private static long MOD=1000000007;//10^9+7
	private static final int N=100000+7; //10^5
//	private static final int LIM=26;
//	private static final double PI=3.1415;
//	private static ArrayList<Integer> v[]=new ArrayList[N];
//	private static int color[]=new int[N];
//	private static boolean mark[]=new boolean[N];
//	private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//	private static void dfs(int node){mark[node]=true;for(int x:v[node]){if(!mark[x]){dfs(x);}}}
	private static long powmod(long x,long n,long m){
		if(n==0)return 1;
		else if(n%2==0)return(powmod((x*x)%m,n/2,m));
		else return (x*(powmod((x*x)%m,(n-1)/2,m)))%m;
	}
//	private static void shuffle(long [] arr) {
//		for (int i = arr.length - 1; i >= 2; i--) {
//			int x = new Random().nextInt(i - 1);
//	        long temp = arr[x];
//	        arr[x] = arr[i];
//	        arr[i] = temp;
//	    }
//	 }
//	private static long gcd(long a, long b){
//		if(b==0)return a;
//		return gcd(b,a%b);
//	}
//	private static boolean check(int x,int y){
//		if((x>=0&&x<n)&&(y>=0&&y<m)&&mat[x][y]!='X'&&!visited[x][y])return true;
//		return false;
//	}
	public static void main(String[] args) throws IOException{
		long n=in.nextLong();
		long res;
		if(n>=3){
			res=n*(n-1)*(n-2);
		}
		else{
			if(n==1)res=1;
			else res=n*n-1;
		}
		out.println(res);
	}
	static class Pair<T> implements Comparable<Pair>{
		int l;
		int r;
		int c;
		Pair(){
			l=0;
			r=0;
		}
		Pair(int k,int v,int p){
			l=k;
			r=v;
			c=p;
		}
		@Override
		public int compareTo(Pair o) {
			if(o.l!=l)return (int) (l-o.l);
			else return (r-o.r);
		}

	}
	static class Reader{
        BufferedReader br;
        StringTokenizer st;
        public Reader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {

                	st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ProblemA {
    public static void main(String[] args) throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        long n = Integer.valueOf(s.readLine());
        long max = 0;

        for (long i = 1 ; i <= n ; i++) {
            max = Math.max(max, solve(n));
        }
        if (n >= 10) {
            for (long i = Math.max(1, n - 10) ; i <= n ; i++) {
                for (long j = Math.max(1, n - 10) ; j <= n ; j++) {
                    for (long k = Math.max(1, n - 10) ; k <= n ; k++) {
                        max = Math.max(max, lcm(i, j, k)) ;
                    }
                }
            }
        }
        out.println(max);
        out.flush();
    }

    private static long lcm(long a, long b, long c) {
        return lcm(lcm(a, b), c);
    }

    private static long lcm(long a, long b) {
        return a * b / gcd(a, b);
    }

    private static long gcd(long a, long b) {
        return (b == 0) ? a : gcd(b, a % b);
    }

    public static long solve(long n) {
        if (n <= 2) {
            return n;
        } else {
            if (n % 2 == 0) {
                return n * (n - 1) * (n - 2) / 2;
            } else {
                return n * (n - 1) * (n - 2);
            }
        }
    }

    public static void debug(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

import java.util.Scanner;

public class gibby
{

    public static void main (String[] args)
    {
        Scanner in = new Scanner(System.in);

        long N = in.nextLong();

        if (N == 1 || N == 2)
            System.out.println(N);

        else if (N%2 == 1)
            System.out.println(N*(N-1)*(N-2));

        else
        {
            long i; boolean cont = true;
            for (i = N-2; i > N/2 && cont; i--)
                if (gcd(i, N) == 1)
                    cont = false;
            i++;

            long ans = (N-1)*(N-2)*(N-3);
            ans = ans < N*(N-1)*i ? N*(N-1)*i : ans;
            System.out.println(ans);
        }

        in.close();
    }

    public static long gcd(long a, long b)
    {
        if (a%b == 0)
            return b;

        return gcd(b, a%b);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Scanner;

public class C {
    static InputStreamReader in = new InputStreamReader(System.in);
    static BufferedReader bf = new BufferedReader(in);
    static StreamTokenizer st = new StreamTokenizer(bf);
    static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws IOException{
        long n = nextInt();
        int []prime = new int [100000];
        int cnt = 0;
        boolean []f = new boolean [(int)1e6+1];
        for (int i = 2; i <=(int)1e6; i++) {
            if (!f[i]){
                prime[cnt++] = i;
                int k = 2;
                while (k*i <= (int) 1e6){
                    f[k*i] = true;
                    k++;
                }
            }
        }
        long t = 0;
        for (int i = cnt-1; i >=0; i--) {
            if (n >= prime[i]){
                t = prime[i];
                break;
            }
        }
        if (n == t){
            System.out.println(t*(t-1)*(t-2));
        }else
            if (n-t >= 2)
        System.out.println(t*(t+1)*(t+2));
            else  System.out.println(t*(t-1)*(t+1));
    }
    private static int nextInt() throws IOException{
        st.nextToken();
        return (int) st.nval;
    }
}

import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;

public class Check2
{
	static int ip[][];
	static int visit[][];
	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars==-1)
				throw new InputMismatchException();

			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}

				if(numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine()
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;
			do
			{
				if(c<'0'||c>'9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
				return res * sgn;
		}

		public double nextDouble()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.')
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.')
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));

			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next()
		{
			return readString();
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}

	static void update(int bit[],int x,int val,int n)
	{
		for(;x<=n;x+= x&-x)
			bit[x]+=val;
	}

	static int query(int bit[],int x,int n)
	{
		int sum=0;

		for(;x>0;x-= x&-x)
			sum+=bit[x];

		return sum;
	}

	static class Node implements Comparable<Node>
	{
		int i;
		int val;

		public Node(int i,int val)
		{
			this.i=i;
			this.val=val;
		}

		public int compareTo(Node node)
		{
			if(node.val==val)
				return Integer.compare(i,node.i);

			return Integer.compare(val,node.val);
		}
	}

	static long lcm(long a,long b)
	{
		return (a* ((b)/gcd(a,b)));
	}

	static long gcd(long a,long b)
	{
		if(b==0)
			return a;
		return gcd(b,a%b);
	}

	public static void main(String args[]) throws Exception
	{
		InputReader sc=new InputReader(System.in);
		PrintWriter w=new PrintWriter(System.out);

		int max=1000001;

		int count=0;
		long n=sc.nextInt();
		if(n==1)
			w.println("1");
		else if(n==2)
			w.println("2");
		else
		{
			long arr[]=new long[3];
			arr[count]=n;
			count++;

			for(long i=n-1;i>0;i--)
			{
				if(count==3)
					break;
				if(count==1)
				{
					if(gcd(arr[0],i)==1)
					{
						arr[count++]=i;
					}
				}
				else if(count==2)
				{
					if(gcd(arr[0],i)==1 && gcd(arr[1],i)==1)
						arr[count++]=i;
				}
			}
			w.println(arr[0]*arr[1]*arr[2]);

		}
		w.close();
	}
}

import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt();

        long res = 0;
        for (int i=Math.max(1,n-50);i<=n;i++) {
            for (int j=i;j<=n;j++) {
                for (int k=j;k<=n;k++) {
                    res = Math.max(lcm(i,j,k),res);
                }
            }
        }
        System.out.println(res);
    }
    public static long lcm(int a,int b,int c) {
        return ((a*b*c)/(gcd(a,b)*gcd(b,c)*gcd(a,c)));
    }
    public static long gcd(int a,int b) {
        return ((b==0) ? a : gcd(b,a%b));
    }
}

import java.util.*;
public class java
{
         public static void main(String args[])
         {
                  Scanner scan=new Scanner(System.in);
                  int n=scan.nextInt();
                  if(n==1)
                  System.out.println(1);
                  else
                  if(n==2)
                  System.out.println(2);
                  else
                  if(n==3)
                  System.out.println(6);
                  else
                  {
                           long g=0;
                           if(n%2==0)
                           g=(n-1)*(n-2)*(n-3);
                           else
                           g=(n-1)*(n)*(n-2);
                           System.out.println(g);
                  }
         }
}

import java.util.*;
import java.lang.*;

public  class Practice{

     static long gcd(long a, long b)
	{
	if (b == 0)
		return a;
	return gcd(b, a % b);
	}
     public static void main (String[] args) {

	    	/*System.out.println(storedprimes);*/

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		long count=1;

		for(int  i=n-10;i<=n;i++){
		     int localcount = 1;
		 for(int  j=n-10;j<=n;j++){

		     for(int  k=n-10;k<=n;k++){
		         if(i>0&&j>0&&k>0){
		          long firstlcm = (i*j)/(gcd(i,j));
		          long secondlcm = (firstlcm*k)/(gcd(firstlcm,k));
		          if(count<secondlcm)
		               count = secondlcm;
		         }
		      }
		 }
		}
		System.out.println(count);

     }

}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//package codeforcespractice;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author admin
 */
public class CodeforcesPractice {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        long n=Integer.parseInt(br.readLine());
        long ans;

        if(n%2!=0){
        ans=n*(n-1)*(n-2);
        }
        else{
                if(n%3!=0){
                ans=Math.max((n*(n-1)*(n-2))/2,n*(n-1)*(n-3));
                }
                else{
                ans=Math.max((n*(n-1)*(n-2))/2,(n-1)*(n-2)*(n-3));
                }
        }
        System.out.println(ans);
    }
}

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int test_cases = 1;
        Solver s = new Solver();
        for (int i = 1; i <= test_cases; i++) {
            s.solve(i, in, out);
        }
        out.close();
    }
}

class Solver {
    void solve(int test_number, InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        if (n == 1) {
            out.println(1);
            return;
        }
        if (n == 2) {
            out.println(2);
            return;
        }
        if (n == 3) {
            out.println(6);
            return;
        }
        long max = -1;
        for (int i = Math.max(n - 50, 0); i + 2 <= n; i++) {
            max = Math.max(findLcm(i, i + 1, i + 2), max);
        }
        out.println(max);
    }

    private long findLcm(int first, int second, int i) {
        long g = first;
        g = (second * g) / (gcd(second, g));
        g = (i * g) / (gcd(i, g));
        return g;
    }

    private long gcd(long a, long b) {
        while (b > 0) {
            long tt = a % b;
            a = b;
            b = tt;
        }
        return a;
    }
}

class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader()
    {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }

    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try
            {
                st = new StringTokenizer(br.readLine());
            }
            catch (IOException  e)
            {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt()
    {
        return Integer.parseInt(next());
    }

    long nextLong()
    {
        return Long.parseLong(next());
    }

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    String nextLine()
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;

public class R146C {
    public static void main (String[] args) throws java.lang.Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n = in.nextInt();
        long temp = 1L * n * (n - 1);
        long min = Long.MAX_VALUE, ans = n - 2;
        for (int i = n - 2; i >= 2; i--) {
            long gcdtemp = gcd(temp, i);
            if (gcdtemp < min) {
                min = gcdtemp;
                ans = i;
            }
        }
       // w.println("ans is : " + ans);
        if (n < 3)
            w.println(n);
        else
            w.println((ans * temp) / min);

        w.close();
    }
    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String nextString() {
            return next();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

import java.io.*;
import java.util.*;
public class LCMChallenge{
	public static long gcd(long a, long b){
		return (b==0)?a:gcd(b, a%b);
	}
	public static void main(String fdjkfd[])throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		long n = Integer.parseInt(br.readLine());
		if(n>=3)
		for(long i=n-2;i>0;i--){
			if(gcd(i,n)==1 && gcd(i, n-1)==1){
				System.out.println((n*(n-1)*i));
				break;
			}
		}
		else
			System.out.println(n);
	}
}

import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.List;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Morgrey
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        cf146A solver = new cf146A();
        solver.solve(1, in, out);
        out.close();
    }
}

class cf146A {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int n = in.readInt();
        if(n >= 3) {
            if (n % 2 == 0)
                n--;
            long k = IntegerUtils.lcm(n, n - 1);
            out.printLine(IntegerUtils.lcm(k, n - 2));

        }
        else if(n == 2){
            out.printLine(2);
        }
        else{
            out.printLine(1);
        }
    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public void close() {
        writer.close();
    }

    public void printLine(long i) {
        writer.println(i);
    }

    public void printLine(int i) {
        writer.println(i);
    }
}

class IntegerUtils {
    public static long gcd(long a, long b) {
        a = Math.abs(a);
        b = Math.abs(b);
        while (b != 0) {
            long temp = a % b;
            a = b;
            b = temp;
        }
        return a;
    }

    public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }

}

import java.io.*;
import java.util.*;

public class Codeforces
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(bu.readLine());
        if(n<3) {System.out.print(n); return;}
        if(n%2==1)
        {
            long ans=1l*n*(n-1)*(n-2);
            System.out.print(ans);
        }
        else
        {
            long ans1=1l*n*(n-1)*(n-2)/4,ans2=1l*(n-1)*(n-2)*(n-3);
            System.out.print(Math.max(ans1,ans2));
        }
    }
}

import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;

public class C146 {
	static PrintWriter out;

	public void solve(){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if( N == 1)
			out.println(1);
		else if(N == 2)
			out.println(2);
		else if(N == 6)
			out.println( 5 * 4 * 3);
		else{
			if( N % 2 == 1){
				out.println( N * (N-1) * (N-2));
			}
			else{
				out.println( N * (N-1) * (N-3));
			}
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		out = new PrintWriter(new OutputStreamWriter(System.out));
		new C146().solve();
		out.close();
	}

}

import java.util.*;
import java.io.*;
public class LCMChallenge
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();

		if(n < 3)
		{
			System.out.println(n);
		}
		else
		{
			System.out.println(n * (n - 1) * (n - 2));
		}
	}
}

import java.util.*;
import java.io.*;
public class CF235A {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int n = sc.nextInt();

      long ans = n * (n - 1) * (n - 2);
      if(n % 2 == 0)
         ans = (n - 1) * (n - 2) * (n - 3);
      if(n == 1)
         ans = 1;
      if(n == 2)
         ans = 2;
      System.out.println(ans);
   }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author JENISH
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CLCMChallenge solver = new CLCMChallenge();
        solver.solve(1, in, out);
        out.close();
    }

    static class CLCMChallenge {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {

            long n = in.scanLong();

            if (n == 1) {
                out.println(1);
                return;
            }
            long ans = LCM(n, n - 1);
            long temp = ans;
            for (int i = 1; i <= n; i++) {
                ans = Math.max(ans, LCM(temp, i));
            }
            out.println(ans);
        }

        long LCM(long a, long b) {
            return (a * b) / CodeX.GCD(a, b);
        }

    }

    static class CodeX {
        public static long GCD(long A, long B) {
            if (B == 0)
                return A;
            else
                return GCD(B, A % B);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

        public long scanLong() {
            long I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

    }
}

import java.util.Scanner;

public class A235 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        if (a % 2 == 0) {
            long result = (a - 1) * (a - 2) * (a - 3);
            result = Math.max((a - 1) * (a - 2) * (a - 0), result);
            System.out.println(Math.max(result, 1));
        }

        else {
            long result = (a - 1) * (a - 2) * (a - 0);
            System.out.println(Math.max(result, 1));
        }
    }

    private static long gcd(long l, long i) {
        if (l % i == 0) {
            return i;
        }
        return gcd(i, l % i);
    }

}

import java.io.*;
import java.util.*;
public class Solution{

                 static long solve(long n){

                         long ans=0;
                         for(long i=n;i>=Math.max(3,n-50);i--){
                                long lcm=0;
                                if(i%2==1) lcm = (i*(i-1)*(i-2));
                                else lcm = (i-1)*(i-2)*(i-3);
                                 if(ans<lcm) ans=lcm;
                          }
                     return(ans);
                 }

                 public static void main(String[] args){

                      int n = intt();
                      if(n==1) out.println("1");
                      else if(n==2) out.println("2");
                      else if(n==3) out.println("6");
                      else  out.println(solve(n));

                      out.flush();
              }
                static FastReader sc=new FastReader();
                static PrintWriter out = new PrintWriter(System.out);
                static int mod=1000000007;

                static int intt(){
                       int x = sc.nextInt();
                       return(x);
                }
               static long longg(){
                          long x = sc.nextLong();
                           return(x);
                }
               static double doublee(){
                          double t = sc.nextDouble();
                           return(t);
                }
              static String str(){
                       String s = sc.next();
                         return(s);
                }
              static String strln(){

                        String s = sc.nextLine();
                           return(s);
              }
              static long pow(long a,long b){
                       long ans=1;
                      while(b>0){
                          if(b%2==1)
                              ans=(ans*a);
                              a=(a*a)%mod;
                              b=b/2;
                      }
                    return(ans);
                }
             static long GCD(long a,long b){
                           if(b%a==0)
                               return(a);
                               return(GCD(b%a,a));
              }
            static long LCM(long a,long b){
                         return ((a*b)/GCD(a,b));
               }
              static long Fermat(long a,long p){
                           long b = p-2,ans=1;
                            while(b>0){
                                 if(b%2==1)
                                      ans=(ans*a)%p;
                                       a=(a*a)%p;
                                       b=b/2;
                              }
                           return(ans);
                   }
              static void Fact(long a[],long m){
                              a[0]=1;
                           for(int i=1;i<a.length;i++)
                                   a[i]=(i*a[i-1])%m;

                      }
              static void Fact_Inv(long a[],long F[],long m){

                                 int n =a.length;
                                     a[n-1]=Fermat(F[n-1],m);
                                 for(int i=n-2;i>=0;i--)
                                        a[i]=((i+1)*a[i+1])%m;
                        }
               /*static  long d, x, y;
              static void extendedEuclid(long A, long B) {
                            if(B == 0) {
                                  d = A;
                                  x = 1;
                                  y = 0;
                              }
                           else {
                                extendedEuclid(B, A%B);
                                 long temp = x;
                                  x = y;
                                 y = temp - (A/B)*y;
                            }
                     } */
                 /*static class pair implements Comparable<pair>{
                       int x,y;
                      pair(int a,int b){
                             x=a;
                             y=b;
                       }
                     public int compareTo(pair p1)
                           { return((p1.x-p1.y)-(this.x-this.y));}

                   public boolean equals(Object obj) {
                         if (this == obj)
                                return true;
                        if (obj == null)
                                return false;
                        if (getClass() != obj.getClass())
                                return false;
                         pair other = (pair) obj;
                          if (x != other.x)
                                  return false;
                          if (y != other.y)
                                  return false;
                            return true;
                      }
                      @Override
                 public int hashCode() {
                      return(x-y);
                   }
          }   */

      static void addEdge(LinkedList<Integer> adjList[],int s,int d){
                             adjList[s].add(d);
                             adjList[d].add(s);
              }
       static int abs(char x,char y)
                   { return(Math.abs(x-y));}
        static long min(long x,long y){
                     return(Math.min(x,y));
                 }
        static long max(long a,long b){
                        return Math.max(a,b);
                  }
         static boolean correct(int n){
                          if((n&(n+1))==0)
                              return(true);
                              return(false);
                  }
           static class pair{
                        int val;
                        int l,level,bit ; // l=-1; if not any level is flipped
                        pair(int v,int L,int j,int b){
                               val = v;
                               l =L;
                               level = j;
                                bit=b;
                        }
            }
         static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.text.DecimalFormat;
import java.lang.Math;
import java.util.Iterator;
public class C39{
    static class Pair implements Comparable<Pair>{
		int v;
		int i;
		public Pair(int v, int i) {
			this.v = v;
			this.i = i;
		}
		@Override
		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			return this.v-o.v;
		}
	}
	public static long gcd(long a, long b){
	    if(b==0){
	        return a;
	    }
	    else{
	        return gcd(b, a%b);
	    }
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long res = 0;
		int flag = 0;
		long b = 0;
		if(n==1 || n==2){
		    System.out.println(n);
		    return;
		}
		for(long i = n-1; i >= 1; i--){
		    if(gcd(i,n)==1 && flag == 0){
		        b = i;
		        res = n*b;
		        flag = 1;
		    }
		    if(gcd(i,n)==1 && gcd(i,b)==1 && flag == 1){
		        res = res*i;
		        flag=2;
		        break;
		    }
		}
		if(flag==2){
		    System.out.println(res);
		}
		else{
		    System.out.println(res*(b-1));
		}
	}
}

import java.util.*;
public class lcm{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long store = 0;
        if(n == 1){
            store = 1;
        }else if(n == 2){
            store = 2;
        }else if(n%2 == 0){
            store = (long)Math.max((n-1)*(n-2)*(n-3),n*(n-1)*(n-2)*0.5);
        }else{
            store = n*(n-1)*(n-2);
        }
        System.out.println(store);
    }
}

import java.io.*;
import java.util.*;

public class Example {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(in.readLine());
            } catch (Exception e) {
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    static long lcm(long a, long b, long c) {
        long res = a * b / gcd(a, b);
        res = res * c / gcd(res, c);
        return res;
    }

    static long next(long x) {
        long y = x - 1;
        while (gcd(x, y) != 1) {
            y--;
        }
        return y;
    }

    static long next(long x, long y) {
        long z = y - 1;
        while (gcd(x, z) != 1 || gcd(y, z) != 1) {
            z--;
        }
        return z;
    }

    public void run() throws Exception {
        //in = new BufferedReader(new FileReader("D.IN"));
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        long n = nextLong();
        long ans = 0;
        for (long x = n; x > 2 && x > n - 100000; x--) {
            long y = next(x);
            long z = next(x, y);
            long nok = x * y * z;
            if (ans < nok) {
                ans = nok;
            }
        }
        if (n == 6) {
            ans = 60;
        }
        out.println(ans);
        out.flush();
        out.close();
        in.close();
    }

    public static void main(String[] args) throws Exception {
        new Example().run();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Solution3 {

	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		long n = Long.parseLong(br.readLine());
		if(n==1)
			System.out.println(1);
		else if(n==2)
			System.out.println(2);
		else if(n==3)
			System.out.println(6);
		else
		{
			if(n%2==0 && n%3==0)
				System.out.println((n-3)*(n-1)*(n-2));
			else if(n%2==0)
				System.out.println(Long.max((n-3)*(n-1)*(n-2), n*(n-1)*(n-2)));
			else
				System.out.println(n*(n-1)*(n-2));
		}

	}
	static long gcd(long a,long b)
	{
		long min = Long.min(a, b);
		long max = Long.max(a, b);

		if(max%min==0)
			return min;
		return gcd(max%min,min);
	}

}

import java.util.*;

public class Main{

    public void run(){

	Scanner in = new Scanner(System.in);
	long n = in.nextLong();
	if (n == 1){
	    System.out.println(1);
	    return;
	}
	if (n == 2){
	    System.out.println(2);
	    return;
	}
	if (n == 3){
	    System.out.println(3);
	    return;
	}
	long max = 0;
	for(long i=n;i>3;i--){
	    long lcm = i * (i - 1);
	    long r = lcm(lcm, i-2);
	    max = Math.max(max, r);
	    r = lcm(lcm, i-3);
	    max = Math.max(max, r);
	    lcm = i * (i-2);
	    r = lcm(lcm, i-3);
	    max = Math.max(max, r);
	}

	System.out.println(max);
    }

    private long gcd(long a, long b){
	return (a % b == 0) ? b : gcd(b, a%b);
    }

    private long lcm(long a, long b) {
	return a * b / gcd(a, b);
    }

    public static void main(String ag[]){
	new Main().run();
    }
}

import java.util.*;
import java.io.*;

public class marte{

private int contor=0;

public static void main (String args[]) throws Exception{

Scanner input=new Scanner(System.in);

HashMap<Integer, Integer> map= new HashMap<Integer, Integer>();
HashMap<String, Integer> map2= new HashMap<String, Integer>();
HashMap<Integer, Integer> finish= new HashMap<Integer, Integer>();
HashMap<Integer, Integer> maxime= new HashMap<Integer, Integer>();

	int n=input.nextInt();

	Long raspuns;Long rez=0l;
	if(n==1) System.out.println(1);
	else if(n==2) System.out.println(2);
	else if(n==3)  System.out.println(6);
	else

	if(n>3) {
	    int ggcd=1000001;
	    raspuns=n*(n-1)*1l;
	    int poz=n-2;

	    for(int j=n-2;j>1;j--){

	     //   System.out.println(j+" "+gcd(j,n)*  gcd(n-1,j));

	    if (gcd(j,n)*  gcd(n-1,j)<ggcd) {ggcd=gcd(j,n)*gcd(n-1,j);

	    poz=j;
	    }
	    }
	   // System.out.println("poz="+poz);

	    raspuns=raspuns*poz/ggcd;

	    System.out.println(raspuns);

		}

    }
    public static int gcd(int a,int b){

		while(a!=b){
		if(a>b) a=a-b;
		else b-=a;

		}
		return a;

		}

    }

import java.util.Scanner;

public class LCMChallenge {
    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static long lcm(long a, long b) {
        return a * b / gcd(a, b);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long res = n * (n - 1);
        long max = 0;
        for (long i = n; i >= 1; i--) {
            max = Math.max(max, lcm(res, i));
        }
        System.out.println(Math.max(max, 1));
    }
}

import sun.misc.Queue;

import java.io.*;
import java.lang.reflect.AnnotatedArrayType;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Random;
import java.util.StringTokenizer;

public class Main {

    long b = 31;
    String fileName = "";

    //////////////////////    SOLUTION   SOLUTION  SOLUTION    //////////////////////////////
    long INF = Long.MAX_VALUE / 10000;
    int MODULO = 1000*1000*1000+7;

    ArrayList<DoubleEdge>[] graph;
    int[] distFromRoot;
    int[] distToRoot;
    int[][] up;
    int[] tin;
    int[] tout;
    int l;
    int timer;
    void solve() throws IOException {
        long n = readInt();
        if (n <= 2){
            out.println(n);
            return;
        }
        if (n == 6){
            out.println(60);
            return;
        }
        boolean[] primes = new boolean[1000000+100];
        for (int i=2; i<=1000000; ++i){
            if (!primes[i])
                for (int j = i+i; j<=1000000; j+=i)
                    primes[j] = true;
        }
        if (n%2 == 1) out.println(n * (n-1) * (n-2));
        else{
            long curAns = n * (n-1);
            for (int i=2; i<=n; ++i){
                if (!primes[i]&&n%i!=0){
                    out.println(curAns * (n-i));
                    return;
                }
            }
        }
    }

    boolean upper(int a, int b){
        return tin[a] <= tin[b] && tout[a] >= tout[b];
    }

    int getDist(int a, int b){
        int lca = lca(a, b);
        return distToRoot[b] - distToRoot[lca] + distFromRoot[a] - distFromRoot[lca];
    }
    int lca(int a, int b){
        if (upper(a, b)) return a;
        if (upper(b, a)) return b;
        for (int i=l; i>=0; --i)
            if (!upper(up[a][i], b))
                a = up[a][i];
        return up[a][0];
    }
    void dfs(int from, int p){
        tin[from] = timer++;
        up[from][0] = p;
        for (int i=1; i<=l; ++i) up[from][i] = up[up[from][i-1]][i-1];
        for (DoubleEdge e: graph[from]){
            if (e.to != p){
                distFromRoot[e.to] = distFromRoot[from] + e.dist1;
                distToRoot[e.to] = distToRoot[from] + e.dist2;
                dfs(e.to, from);
            }
        }
        tout[from] = ++timer;
    }
    class Vertex implements Comparable<Vertex>{
        int dist, from;
        Vertex(int b, int c){
            this.dist = c;
            this.from = b;
        }

        @Override
        public int compareTo(Vertex o) {
            return this.dist-o.dist;
        }
    }
    ///////////////////////////////////////////////////////////////////////////////////////////
    class DoubleEdge{
        int from, to, dist1, dist2;
        DoubleEdge(int from, int to, int dist1, int dist2){
            this.from = from;
            this.to = to;
            this.dist1 = dist1;
            this.dist2 = dist2;
        }
    }

    class Edge{
        int from, to, dist;
        Edge(int from, int to, int dist){
            this.from = from;
            this.to = to;
            this.dist = dist;
        }
    }

    void readUndirectedGraph (int n, int m, int[][] graph) throws IOException{
        Edge[] edges = new Edge[n-1];
        int[] countEdges = new int[n];
        graph = new int[n][];
        for (int i=0; i<n-1; ++i){
            int from = readInt() - 1;
            int to = readInt() - 1;
            countEdges[from]++;
            countEdges[to]++;
            edges[i] = new Edge(from, to, 0);
        }
        for (int i=0; i<n; ++i) graph[i] = new int[countEdges[i]];
        for (int i=0; i<n-1; ++i){
            graph[edges[i].to][--countEdges[edges[i].to]] = edges[i].dist;
            graph[edges[i].dist][-- countEdges[edges[i].dist]] = edges[i].to;
        }
    }
    class SparseTable{
        int[][] rmq;
        int[] logTable;
        int n;
        SparseTable(int[] a){
            n = a.length;
            logTable = new int[n+1];
            for(int i = 2; i <= n; ++i){
                logTable[i] = logTable[i >> 1] + 1;
            }
            rmq = new int[logTable[n] + 1][n];
            for(int i=0; i<n; ++i){
                rmq[0][i] = a[i];
            }

            for(int k=1; (1 << k) < n; ++k){
                for(int i=0; i + (1 << k) <= n; ++i){
                    int max1 = rmq[k - 1][i];
                    int max2 = rmq[k-1][i + (1 << (k-1))];
                    rmq[k][i] = Math.max(max1, max2);
                }
            }
        }

        int max(int l, int r){
            int k = logTable[r - l];
            int max1 = rmq[k][l];
            int max2 = rmq[k][r - (1 << k) + 1];
            return Math.max(max1, max2);
        }
    }
    long checkBit(long mask, int bit){
        return (mask >> bit) & 1;
    }
    class Dsu{
        int[] parent;
        int countSets;
        Dsu(int n){
            countSets = n;
            parent = new int[n];
            for(int i=0; i<n; ++i){
                parent[i] = i;
            }
        }
        int findSet(int a){
            if(parent[a] == a) return a;
            parent[a] = findSet(parent[a]);
            return parent[a];
        }
        void unionSets(int a, int b){
            a = findSet(a);
            b = findSet(b);
            if(a!=b){
                countSets--;
                parent[a] = b;
            }
        }
    }
    static int checkBit(int mask, int bit) {
        return (mask >> bit) & 1;
    }
    boolean isLower(char c){
        return c >= 'a' && c <= 'z';
    }

    ////////////////////////////////////////////////////////////

    class SegmentTree{
        int[] t;
        int n;
        SegmentTree(int n){
            t = new int[4*n];
            build(new int[n+1], 1, 1, n);
        }
        void build (int a[], int v, int tl, int tr) {
            if (tl == tr)
                t[v] = a[tl];
            else {
                int tm = (tl + tr) / 2;
                build (a, v*2, tl, tm);
                build (a, v*2+1, tm+1, tr);
            }
        }

        void update (int v, int tl, int tr, int l, int r, int add) {
            if (l > r)
                return;
            if (l == tl && tr == r)
                t[v] += add;
            else {
                int tm = (tl + tr) / 2;
                update (v*2, tl, tm, l, Math.min(r,tm), add);
                update (v*2+1, tm+1, tr, Math.max(l,tm+1), r, add);
            }
        }

        int get (int v, int tl, int tr, int pos) {
            if (tl == tr)
                return t[v];
            int tm = (tl + tr) / 2;
            if (pos <= tm)
                return t[v] + get (v*2, tl, tm, pos);
            else
                return t[v] + get (v*2+1, tm+1, tr, pos);
        }
    }
    class Fenwik {
        long[] t;
        int length;

        Fenwik(int[] a) {
            length = a.length + 100;
            t = new long[length];

            for (int i = 0; i < a.length; ++i) {
                inc(i, a[i]);
            }
        }

        void inc(int ind, int delta) {
            for (; ind < length; ind = ind | (ind + 1)) {
                t[ind] += delta;
            }
        }

        long getSum(int r) {
            long sum = 0;
            for (; r >= 0; r = (r & (r + 1)) - 1) {
                sum += t[r];
            }
            return sum;
        }
    }
    int gcd(int a, int b){
        return b == 0 ? a : gcd(b, a%b);
    }
    long gcd(long a, long b){
        return b == 0 ? a : gcd(b, a%b);
    }
    long binPow(long a, long b, long m) {
        if (b == 0) {
            return 1;
        }
        if (b % 2 == 1) {
            return ((a % m) * (binPow(a, b - 1, m) % m)) % m;
        } else {
            long c = binPow(a, b / 2, m);
            return (c * c) % m;
        }

    }
    int minInt(int... values) {
        int min = Integer.MAX_VALUE;
        for (int value : values) min = Math.min(min, value);
        return min;
    }

    int maxInt(int... values) {
        int max = Integer.MIN_VALUE;
        for (int value : values) max = Math.max(max, value);
        return max;
    }
    public static void main(String[] args) throws NumberFormatException, IOException {
        // TODO Auto-generated method stub
        new Main().run();
    }

    void run() throws NumberFormatException, IOException {
        solve();
        out.close();
    };

    BufferedReader in;
    PrintWriter out;

    StringTokenizer tok;
    String delim = " ";
    Random rnd = new Random();

    Main() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            if (fileName.isEmpty()) {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                in = new BufferedReader(new FileReader(fileName + ".in"));
                out = new PrintWriter(fileName + ".out");
            }

        }
        tok = new StringTokenizer("");
    }

    String readLine() throws IOException {
        return in.readLine();
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            String nextLine = readLine();
            if (null == nextLine) {
                return null;
            }

            tok = new StringTokenizer(nextLine);
        }
        return tok.nextToken();
    }

    int readInt() throws NumberFormatException, IOException {
        return Integer.parseInt(readString());
    }
    byte readByte() throws NumberFormatException, IOException {
        return Byte.parseByte(readString());
    }
    int[] readIntArray (int n) throws NumberFormatException, IOException {
        int[] a = new int[n];
        for(int i=0; i<n; ++i){
            a[i] = readInt();
        }
        return a;
    }

    Integer[] readIntegerArray (int n) throws NumberFormatException, IOException {
        Integer[] a = new Integer[n];
        for(int i=0; i<n; ++i){
            a[i] = readInt();
        }
        return a;
    }

    long readLong() throws NumberFormatException, IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(readString());
    }
}

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int num=in.nextInt();
        int lcm=1;
        if(num==2){
            System.out.println(2);
            System.exit(0);
        }//End if
        else if(num%2==0&&num%3!=0)
            lcm=(num)*(num-1)*(num-3);
        else if(num%2==0&&num%3==0)
            lcm=(num-1)*(num-2)*(num-3);
        else if(num%2!=0&&num>2)
            lcm=num*(num-1)*(num-2);
        System.out.println(lcm);
    }//End main()
}//End class

import java.util.Scanner;

public class LCMChallenge {
    public static void main(String[] args) {
        Scanner scan =  new Scanner(System.in);
        int n = scan.nextInt();

        if(n<=2){
            System.out.println(n);
            return;
        }

        boolean sieve[] = new boolean[n + 1];
        sieve[0] = false;
        sieve[1] = false;
        for(int i=2;i<=n;i++){
            sieve[i] = true;
        }

        for(int i=2;i<=n;i++){
            int count = i;
            while((int) (i * count) <= n){
                sieve[(int) (i * count)] = false;
                count++;
            }
        }

        long lcm = 0;
        if(sieve[n] || sieve[n-2]){
            lcm = n * (n-1) * (n -2);
        }else if(sieve[n-1]){
            int gPrime = 0;
            for(int i=n-2;i>=0;i--){
                if(sieve[i]){
                    gPrime = i;
                    break;
                }
            }
            lcm = n * (n-1) * gPrime;
        }else{
            int gPrime = 0;
            for(int i=n-1;i>=0;i--){
                if(sieve[i]){
                    gPrime = i;
                    break;
                }
            }
            lcm = n * (n-1) * gPrime;
        }
        System.out.println(lcm);
    }
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{   int i,j;
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out=new PrintWriter(System.out);
		int n=Integer.parseInt(br.readLine());
		long ans=1;
		if(n%2==1)
		    ans=n*(n-1)*(n-2);
		else
		    ans=Math.max(n*(n-1)*(n-2)/2,(n-1)*(n-2)*(n-3));
		if(n==1)
	        ans=1;
	    if(n==2)
	        ans=2;
		out.println(ans);
		out.close();
	}
}

import java.util.Scanner;

/**
 *
 * @author Tolik
 */
public class Codeforces1 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        if (n <= 2){
            System.out.println(n);
            return;
        }
        long tmp = n * (n - 1);
        if (n % 2 == 0){
            System.out.println((tmp * (n - 3)));
        }else{
            System.out.println((tmp * (n - 2)));
        }

    }
}

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Alex
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
		long n = in.readInt();
		if (n == 1) {out.print(1); return;}
		if (n == 2) {out.print(2); return;}
		if (n == 4) {out.print(12); return;}
		if (n%2 == 0) n--;
		out.print(n*(n-1)*(n-2));
    }
}

class InputReader {
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}
	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	public static boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}
	public void close() {
		writer.close();
	}
	public void print(long i) {
		writer.print(i);
	}
	public void print(int i) {
		writer.print(i);
	}
}

import java.math.BigInteger;
import java.util.Scanner;
public class LCMChallenge {
	public static void main(String [] args) throws Exception{
		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		if(n<3)System.out.println(n);
		else if(n==3)System.out.println(6);
		else {
			if(n%2==0)n--;
			BigInteger bi = BigInteger.valueOf(n).multiply(BigInteger.valueOf(n-1)).multiply(BigInteger.valueOf(n-2));
			System.out.println(bi);
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C {
    static BufferedReader in;
    static StringTokenizer st;
    static PrintWriter out;

    static String nextToken() throws IOException {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    static int nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(nextToken());
    }
    static long nextLong() throws NumberFormatException, IOException {
        return Long.parseLong(nextToken());
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        st = new StringTokenizer(in.readLine());
        out = new PrintWriter(new OutputStreamWriter(System.out));
        int n = nextInt();
        if(n <= 2){
            System.out.println(n);
            return;
        }
        long a = n;
        long b = n-1;
        long c = (n-2)/gcd(a , n-2);
        for (int i = n; i >= 1; i--) {
            if(c<i && gcd(a,i) == 1 && gcd(b,i)==1){
                c = i;
                break;
            }
        }
        System.out.println((long) a*b*c);
    }
    private static long gcd(long a, long b) {
        if(b==0){
            return a;
        }
        return gcd(b, a % b);
    }
}

import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;

public class C146 {
	static PrintWriter out;

	public void solve(){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if( N == 1)
			out.println(1);
		else if(N == 2)
			out.println(2);
		else if(N == 6)
			out.println( 5 * 4 * 3);
		else{
			if( N % 2 == 1){
				out.println( N * (N-1) * (N-2));
			}
			else{
				out.println( N * (N-1) * (N-3));
			}
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		out = new PrintWriter(new OutputStreamWriter(System.out));
		new C146().solve();
		out.close();
	}

}

import java.util.Scanner;
public class LCM
{
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int res = 0;
if(n < 3)
{System.out.println(n);
 return;
}
if(n % 2 == 1)
{System.out.println(n * (n - 1) * (n - 2));
 return;
}
else
{
for(int i = n - 3;i >= 0; i -= 2){
  if(gcd(n, i) != 1 || gcd(n - 1, i) != 1)
    continue;
  res = Math.max(n * (n - 1) * i,
             Math.max((n * (n - 1) / 2) * (n - 2),
    (n - 1) * (n - 2) * (n - 3)));
  break;}
}
System.out.println(res );
}
private static int gcd(int a, int b)
{
if(a % b == 0)
   return b;
return gcd(b, a % b);
}
}

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int test_cases = 1;
        Solver s = new Solver();
        for (int i = 1; i <= test_cases; i++) {
            s.solve(i, in, out);
        }
        out.close();
    }
}

class Solver {
    static class Pair {
        long lcm, x, y, z;

        public Pair(long l, int xx, int yy, int zz) {
            lcm = l;
            x = xx;
            y = yy;
            z = zz;
        }

    }
    void solve(int test_number, InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        if (n == 1) {
            out.println(1);
            return;
        }
        if (n == 2) {
            out.println(2);
            return;
        }
        if (n == 3) {
            out.println(6);
            return;
        }
        if (n % 2 == 1) {
            out.println( (n) * (n - 1) * (long) (n - 2));
            return;
        }
        long max = -1;
        ArrayList<Integer> v = new ArrayList<>();
        for (int i = Math.max(n - 50, 1); i <= n; i++) {
            v.add(i);
        }
//        ArrayList<Pair> lcm = new ArrayList<>();
        for (int x : v) {
            for (int y : v) {
                for (int z : v) {
//                    if (findLcm(x, y, z) > 1e8) {
//                        out.println(x + " " + y + " " + z + " LCM " + findLcm(x, y, z));
//                        if (!con(lcm, findLcm(x, y, z))) {
//                            lcm.add(new Pair(findLcm(x, y, z), x, y, z));
//                        }
//                    }
                    max = Math.max(findLcm(x, y, z), max);
                }
            }
        }
//        Collections.sort(lcm, new Comparator<Pair>() {
//            @Override
//            public int compare(Pair o1, Pair o2) {
//                return (int) (o1.lcm - o2.lcm);
//            }
//        });
//        for (int i = lcm.size() - 1; i >= lcm.size() - 20; i--) {
//            out.println(lcm.get(i).lcm + " LCM " + " " + lcm.get(i).x + " " + lcm.get(i).y + " " + lcm.get(i).z);
//        }
        out.println(max);
    }

    private boolean con(ArrayList<Pair> lcm, long lcm1) {
        for (int i = 0; i < lcm.size(); i++) {
            if (lcm.get(i).lcm == lcm1) return true;
        }
        return false;
    }

    private long findLcm(long first, long second, long i) {
        long g = first;
        g = (second * g) / (gcd(second, g));
        g = (i * g) / (gcd(i, g));
        return g;
    }

    private long gcd(long a, long b) {
        while (b > 0) {
            long tt = a % b;
            a = b;
            b = tt;
        }
        return a;
    }
}

class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader()
    {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }

    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try
            {
                st = new StringTokenizer(br.readLine());
            }
            catch (IOException  e)
            {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt()
    {
        return Integer.parseInt(next());
    }

    long nextLong()
    {
        return Long.parseLong(next());
    }

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    String nextLine()
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
}

/*
Keep solving problems.
*/

import java.util.*;
import java.io.*;

public class CFA {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    private static final long MOD = 1000 * 1000 * 1000 + 7;
    private static final int[] dx = {0, -1, 0, 1};
    private static final int[] dy = {1, 0, -1, 0};
    private static final String yes = "Yes";
    private static final String no = "No";

    void solve() throws IOException {
        long n = nextInt();
        if (n <= 2) {
            outln(n);
            return;
        }
        else if (n == 3) {
            outln(6);
            return;
        }

        long res = 0;
        for (long i = n - 50; i <= n; i++) {
            if (i - 2 >= 1) {
                res = Math.max(res, helper(i - 2, i - 1, i));
            }
        }

        outln(res);
    }

    long helper(long l1, long l2, long l3) {
        long res = l1 * l2 / gcd(l1, l2);
        res = res * l3 / gcd(res, l3);
        return res;
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }

    long gcd(long a, long b) {
        while(a != 0 && b != 0) {
            long c = b;
            b = a % b;
            a = c;
        }
        return a + b;
    }

    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public CFA() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CFA();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}

import java.util.Scanner;

public class LCMChallenge {
    public static void main(String[] args) {
        Scanner scan =  new Scanner(System.in);
        int n = scan.nextInt();

        if(n<=2){
            System.out.println(n);
            return;
        }

        int lcm = 0;
        if(n%2!=0){
            lcm = n * (n - 1) * (n - 2);
        }else{
            int gcd = (int) gcd(n,n-3);
            if(gcd == 1){
                lcm = n * (n - 1) * (n - 3);
            }else{
                lcm = (n - 1) * (n - 2) * (n - 3);
            }
        }

        System.out.println(lcm);
    }

    private static int gcd(int a, int b){
        if(a == 0){
            return b;
        }

        return gcd(b%a,a);
    }
}

//package Codeforces;

import java.util.Scanner;

public class lcmChallenge {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	if(n==2||n==1)
		System.out.println(n);
	else System.out.println(n*1l*(n-1)*(n-2));
}
}

import java.io.*;
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class CF235A {
    static BufferedReader __in;
    static PrintWriter __out;
    static StringTokenizer input;

    public static void main(String[] args) throws IOException {
        __in = new BufferedReader(new InputStreamReader(System.in));
        __out = new PrintWriter(new OutputStreamWriter(System.out));

        int n = ri();
        if(n < 3) prln(n);
        else if(n % 2 == 0) {
            prln((n - 1) * (n - 3) * (n % 3 == 0 ? n - 2 : n));
        } else prln((long) n * (n - 1) * (n - 2));

        close();
    }

    // references
    // IBIG = 1e9 + 7
    // IRAND ~= 3e8
    // IMAX ~= 2e10
    // LMAX ~= 9e18
    // constants
    static final int IBIG = 1000000007;
    static final int IRAND = 327859546;
    static final int IMAX = 2147483647;
    static final int IMIN = -2147483648;
    static final long LMAX = 9223372036854775807L;
    static final long LMIN = -9223372036854775808L;
    // util
    static int minof(int a, int b, int c) {return min(a, min(b, c));}
    static int minof(int... x) {return x.length == 1 ? x[0] : x.length == 2 ? min(x[0], x[1]) : min(x[0], minstarting(1, x));}
    static int minstarting(int offset, int... x) {assert x.length > 2; return offset == x.length - 2 ? min(x[offset], x[offset + 1]) : min(x[offset], minstarting(offset + 1, x));}
    static long minof(long a, long b, long c) {return min(a, min(b, c));}
    static long minof(long... x) {return x.length == 1 ? x[0] : x.length == 2 ? min(x[0], x[1]) : min(x[0], minstarting(1, x));}
    static long minstarting(int offset, long... x) {assert x.length > 2; return offset == x.length - 2 ? min(x[offset], x[offset + 1]) : min(x[offset], minstarting(offset + 1, x));}
    static int maxof(int a, int b, int c) {return max(a, max(b, c));}
    static int maxof(int... x) {return x.length == 1 ? x[0] : x.length == 2 ? max(x[0], x[1]) : max(x[0], maxstarting(1, x));}
    static int maxstarting(int offset, int... x) {assert x.length > 2; return offset == x.length - 2 ? max(x[offset], x[offset + 1]) : max(x[offset], maxstarting(offset + 1, x));}
    static long maxof(long a, long b, long c) {return max(a, max(b, c));}
    static long maxof(long... x) {return x.length == 1 ? x[0] : x.length == 2 ? max(x[0], x[1]) : max(x[0], maxstarting(1, x));}
    static long maxstarting(int offset, long... x) {assert x.length > 2; return offset == x.length - 2 ? max(x[offset], x[offset + 1]) : max(x[offset], maxstarting(offset + 1, x));}
    static int powi(int a, int b) {if(a == 0) return 0; int ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static long powl(long a, int b) {if(a == 0) return 0; long ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static int floori(double d) {return (int)d;}
    static int ceili(double d) {return (int)ceil(d);}
    static long floorl(double d) {return (long)d;}
    static long ceill(double d) {return (long)ceil(d);}
    // input
    static void r() throws IOException {input = new StringTokenizer(__in.readLine());}
    static int ri() throws IOException {return Integer.parseInt(__in.readLine());}
    static long rl() throws IOException {return Long.parseLong(__in.readLine());}
    static int[] ria(int n) throws IOException {int[] a = new int[n]; input = new StringTokenizer(__in.readLine()); for(int i = 0; i < n; ++i) a[i] = Integer.parseInt(input.nextToken()); return a;}
    static long[] rla(int n) throws IOException {long[] a = new long[n]; input = new StringTokenizer(__in.readLine()); for(int i = 0; i < n; ++i) a[i] = Long.parseLong(input.nextToken()); return a;}
    static char[] rcha() throws IOException {return __in.readLine().toCharArray();}
    static String rline() throws IOException {return __in.readLine();}
    static int rni() throws IOException {input = new StringTokenizer(__in.readLine()); return Integer.parseInt(input.nextToken());}
    static int ni() {return Integer.parseInt(input.nextToken());}
    static long rnl() throws IOException {input = new StringTokenizer(__in.readLine()); return Long.parseLong(input.nextToken());}
    static long nl() {return Long.parseLong(input.nextToken());}
    // output
    static void pr(int i) {__out.print(i);}
    static void prln(int i) {__out.println(i);}
    static void pr(long l) {__out.print(l);}
    static void prln(long l) {__out.println(l);}
    static void pr(double d) {__out.print(d);}
    static void prln(double d) {__out.println(d);}
    static void pr(char c) {__out.print(c);}
    static void prln(char c) {__out.println(c);}
    static void pr(char[] s) {__out.print(new String(s));}
    static void prln(char[] s) {__out.println(new String(s));}
    static void pr(String s) {__out.print(s);}
    static void prln(String s) {__out.println(s);}
    static void pr(Object o) {__out.print(o);}
    static void prln(Object o) {__out.println(o);}
    static void prln() {__out.println();}
    static void pryes() {__out.println("yes");}
    static void pry() {__out.println("Yes");}
    static void prY() {__out.println("YES");}
    static void prno() {__out.println("no");}
    static void prn() {__out.println("No");}
    static void prN() {__out.println("NO");}
    static void pryesno(boolean b) {__out.println(b ? "yes" : "no");};
    static void pryn(boolean b) {__out.println(b ? "Yes" : "No");}
    static void prYN(boolean b) {__out.println(b ? "YES" : "NO");}
    static void prln(int... a) {for(int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i); __out.println(a[a.length - 1]);}
    static void prln(long... a) {for(int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i); __out.println(a[a.length - 1]);}
    static <T> void prln(Collection<T> c) {int n = c.size() - 1; Iterator<T> iter = c.iterator(); for(int i = 0; i < n; __out.print(iter.next()), __out.print(' '), ++i); __out.println(iter.next());}
    static void flush() {__out.flush();}
    static void close() {__out.close();}}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.IOException;
public class Main {
	public static void main(String[] args){
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		PrintStream output = new PrintStream(System.out);
		String s = "";
		try{s = input.readLine();}
		catch(IOException e1){e1.printStackTrace();}
		int n = Integer.parseInt(s);
		for(int i = n ; i >= 4 ; i--)
		{
			if(gcd(gcd(n,n-1),n-2) == 1)
			{
				output.println(n*(n-1)*(n-2));
				System.exit(0);
			}
			if(gcd(gcd(n,n-2),n-3) == 1)
			{
				output.println(n*(n-2)*(n-3));
				System.exit(0);
			}
		}
		if(n == 3)
		output.println("6");
		else
			output.println(n);

	}
	static int gcd(int a , int b)
	{
	if(b == 0)return a;
	return gcd(b , a%b);
	}
}

//package que_a;

import java.io.*;
import java.util.*;

public class utkarsh {

    InputStream is;
    PrintWriter out;

    long mod = (long) (1e9 + 7);
    boolean SHOW_TIME;

    int gcd(int a, int b) {
        if(b == 0)  return a;
        return gcd(b, a % b);
    }

    void solve() {
        //Enter code here utkarsh
        //SHOW_TIME = true;
        int n = ni();
        if(n < 3) {
            out.println(n);
            return;
        }
        int x = n-2;
        long ans = 1;
        while(x > 0) {
            ans = Math.max(ans, (1L * n * (n-1) * x) / (1L * gcd(x, n) * gcd(x, n-1)));
            x--;
        }
        out.println(ans);
    }

    //---------- I/O Template ----------

    public static void main(String[] args) { new utkarsh().run(); }
    void run() {
        is = System.in;
        out = new PrintWriter(System.out);
        long start = System.currentTimeMillis();
        solve();
        long end = System.currentTimeMillis();
        if(SHOW_TIME) out.println("\n" + (end - start) + " ms");
        out.flush();
    }

    byte input[] = new byte[1024];
    int len = 0, ptr = 0;

    int readByte() {
        if(ptr >= len) { ptr = 0;
            try { len = is.read(input); }
            catch(IOException e) { throw new InputMismatchException(); }
            if(len <= 0) { return -1; }
        } return input[ptr++];
    }
    boolean isSpaceChar(int c) { return !( c >= 33 && c <= 126 ); }
    int skip() {
        int b = readByte();
        while(b != -1 && isSpaceChar(b)) { b = readByte(); }
        return b;
    }

    char nc() { return (char)skip(); }
    String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    String nLine() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while( !(isSpaceChar(b) && b != ' ') ) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    int ni() {
        int n = 0, b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        if(b == -1) { return -1; }  //no input
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }
    long nl() {
        long n = 0L;    int b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }

    double nd() { return Double.parseDouble(ns()); }
    float nf() { return Float.parseFloat(ns()); }
    int[] na(int n) {
        int a[] = new int[n];
        for(int i = 0; i < n; i++) { a[i] = ni(); }
        return a;
    }
    char[] ns(int n) {
        char c[] = new char[n];
        int i, b = skip();
        for(i = 0; i < n; i++) {
            if(isSpaceChar(b)) { break; }
            c[i] = (char)b; b = readByte();
        } return i == n ? c : Arrays.copyOf(c,i);
    }
}

import java.io.*;
import java.util.*;

public class A {
    public static void solution(BufferedReader reader, PrintWriter out)
            throws IOException {
        In in = new In(reader);
        long n = in.nextLong();
        long ab = n == 1 ? n * n : n * (n - 1);
        long max = 1;
        for (long c = n; c >= 1; c--)
            max = Math.max(max, lcm(ab, c));
        out.println(max);
    }

    private static long lcm(long a, long b) {
        long gcd = gcd(a, b);
        return a / gcd * b;
    }

    private static long gcd(long a, long b) {
        while (b != 0) {
            long t = b;
            b = a % b;
            a = t;
        }
        return a;
    }

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(System.out)));
        solution(reader, out);
        out.close();
    }

    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }
}

import static java.lang.Math.*;
import java.io.*;
import java.util.*;

public class A {
	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(in.readLine());
			} catch(Exception e) {}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}

	boolean bit(int m, int i) {
		return (m & (1 << i)) > 0;
	}

	void db(String ss){
		System.err.println(ss);
	}

	long gcd(long a, long b) {
		return b==0 ? a : gcd(b, a % b);
	}

	long lcm(long a, long b, long c) {
		a = a * b;
		long d = gcd(a,c);
		return a*c/d;
	}

	public void run() {
		in  = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
			int n = nextInt();
			if (n == 1) out.println(1); else {
				Long ans = 0L;
				for (int i=1; i<=n; i++) ans = max(ans, lcm(n,n-1,i));
				out.println(ans);
			}
		out.close();
	}

	class Pair implements Comparable<Pair> {
		int x,y;
		public Pair(int x, int y) {
			this.x=x;
			this.y=y;
		}
		public int compareTo(Pair o) {
			if (x != o.x) return x - o.x;
			return o.y - y;
		}
	}

	int sign(long x) {
		if (x < 0) return -1;
		if (x > 0) return 1;
		return 0;
	}

	public static void main(String[] args) throws Exception {
		new A().run();
	}
}

//number theory
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.Random;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeMap;

public class Rating1600_235A{
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        if(n<3){
            out.println(n);
        }
        else if(n%2==1){
            out.println(n*(n-1)*(n-2));
        }
        else{
            out.println((n-1)*(n-2)*(n-3));
        }
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return reader.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=reader.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            tokenizer=new StringTokenizer(next);
            return true;
        }
    }
}

import java.util.*;
public class LCMChallenge {
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		sc.close();
		if(n<3)
			System.out.println(n);
		else{
			if(n%2==0)
				n--;
			System.out.println(n*(n-2)*((n+1)%3==0?n-1:n+1));
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;

public class Task235A {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Scanner {

		private final BufferedReader br;
		private String[] cache;
		private int cacheIndex;

		Scanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
			cache = new String[0];
			cacheIndex = 0;
		}

		int nextInt() throws IOException {
			if (cacheIndex >= cache.length) {
				cache = br.readLine().split(" ");
				cacheIndex = 0;
			}
			return Integer.parseInt(cache[cacheIndex++]);
		}

		long nextLong() throws IOException {
			if (cacheIndex >= cache.length) {
				cache = br.readLine().split(" ");
				cacheIndex = 0;
			}
			return Long.parseLong(cache[cacheIndex++]);
		}

		String next() throws IOException {
			if (cacheIndex >= cache.length) {
				cache = br.readLine().split(" ");
				cacheIndex = 0;
			}
			return cache[cacheIndex++];
		}

		void close() throws IOException {
			br.close();
		}

	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner sc = new Scanner(is);

			long n = sc.nextLong();

			if (n < 3) {
				pw.println(n);
			} else {
				pw.println(n * (n - 1) * (n - 2));
			}

			pw.flush();
			sc.close();
		}
	}

}

import java.awt.GradientPaint;
import java.awt.geom.Line2D;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;

public class a {
	public static class node {
		long one;
		long two;

		node(long index, long val) {
			one = index;
			two = val;

		}

	}

	public static long gcd(long i, long j) {
		if (j == 0)
			return i;
		else
			return gcd(j, i % j);
	}

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder q = new StringBuilder();
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

		int a = Integer.parseInt(in.readLine());
		if (a == 1) {
			System.out.println(1);
			return;
		}
		long ans = a * (a - 1);
		long max = ans;
		for (int i = a - 2; i >= 1; i--) {
			long g = gcd(ans, i);
			long answer = (ans * i) / g;
			if (answer > max)
				max = answer;

		}
		System.out.println(max);

		out.close();

	}
}

import java.util.*;
import java.io.*;

public class Main implements Runnable {

	public void solve() throws IOException {
		int N = nextInt();
                if(N == 1)
                    System.out.println(1);
                else if(N == 2)
                    System.out.println(2);
                else if(N == 3)
                    System.out.println(6);
                else if((N & 1) == 1)
                    System.out.println(N * (N - 1) * (N - 2)); // odd, even , odd
                else
                    System.out.println((N-1) * (N-2) * (N-3)); // when N is even, go to odd, even, odd

	}

	//-----------------------------------------------------------
	public static void main(String[] args) {
		new Main().run();
	}

        public void print1Int(int[] a){
                for(int i = 0; i < a.length; i++)
                        System.out.print(a[i] + " ");
                System.out.println();
        }

        public void print2Int(int[][] a){
                for(int i = 0; i < a.length; i++){
                        for(int j = 0; j < a[0].length; j++){
                                System.out.print(a[i][j] + " ");
                        }
                        System.out.println();
                }
        }

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			tok = null;
			solve();
			in.close();
		} catch (IOException e) {
			System.exit(0);
		}
	}

	public String nextToken() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	BufferedReader in;
	StringTokenizer tok;
}

import java.awt.GradientPaint;
import java.awt.geom.Line2D;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;

public class a {
	public static class node {
		long one;
		long two;

		node(long index, long val) {
			one = index;
			two = val;

		}

	}

	public static long gcd(long i, long j) {
		if (j == 0)
			return i;
		else
			return gcd(j, i % j);
	}

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder q = new StringBuilder();
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

		int a = Integer.parseInt(in.readLine());
		if (a == 1) {
			System.out.println(1);
			return;
		}
		long ans = (long)a * (long)(a - 1);
		long max = ans;
		for (int i = a - 2; i >= 1; i--) {
			long g = gcd(ans, i);
			long answer = (long)((long)ans * (long)i) / (long)g;
			if (answer > max)
				max = answer;

		}
		System.out.println(max);

		out.close();

	}
}

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Main {

    public static long gcd(long a, long b) {
        if(b == 0) return a;
        return gcd(b, a % b);
    }
    public static long lcm(long a, long b) {
        return a * gcd(a, b) * b;
    }
    public static long lcm(long a, long b, long c) {
        long d = gcd(gcd(a, b), c);
        return a / d * b * c;
    }

    public static void main(String[] args) throws InterruptedException, AWTException, UnknownHostException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        InputReader in = new InputReader(inputStream);

        long ans = Long.MIN_VALUE;
        long n = in.nextLong();
        if(n == 1) out.println(1);
        else if(n == 2) out.println(2);
        else {

            for(int i = 0; i < 10; i++) {
                if(n - 2 - i == 0) break;
                ans = Math.max(lcm(n - i, n - i - 1, n - i - 2), ans);
            }
            out.println(ans);
        }
        out.close();
    }

    static class InputReader {

        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream), 32624);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private double nextDouble() {
            return Double.parseDouble(next());
        }

        public int[] nextArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        public double[] nextArrayd(int n) {
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextDouble();
            }
            return a;
        }

        private BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        public void printAr(long[] a) {
            System.out.print("[");
            for(long x  : a)System.out.print(x + ",");
            System.out.print("]");
        }
    }

}

import java.math.*;
import java.util.*;

public class ProblemC {
	public static void main (String args[]) {

		Scanner scan = new Scanner(System.in);
		long n = scan.nextLong();
		BigInteger num;
		long a = 1, b = 2;
		num = BigInteger.valueOf((n-a)*(n-b)*n);
		System.out.println(num);

	}

}

import java.util.Scanner;
public class LCM {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		if(n < 3) {
			System.out.println(n);
		}
		else if(n % 2 != 0) {
			System.out.println(n * (n-1) * (n-2));
		}
		else if(n % 3 == 0) {
			System.out.println((n-1) * (n-2) * (n-3));
		}
		else {
			System.out.println(n * (n-1) * (n-3));
		}
	}
}

import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.List;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Morgrey
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        cf146A solver = new cf146A();
        solver.solve(1, in, out);
        out.close();
    }
}

class cf146A {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int n = in.readInt();
        if(n >= 3) {
            long k = IntegerUtils.lcm(n, n - 1);
            out.printLine(IntegerUtils.lcm(k, n - 2));
        }
        else if(n == 2){
            out.printLine(2);
        }
        else{
            out.printLine(1);
        }
    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public void close() {
        writer.close();
    }

    public void printLine(long i) {
        writer.println(i);
    }

    public void printLine(int i) {
        writer.println(i);
    }
}

class IntegerUtils {
    public static long gcd(long a, long b) {
        a = Math.abs(a);
        b = Math.abs(b);
        while (b != 0) {
            long temp = a % b;
            a = b;
            b = temp;
        }
        return a;
    }

    public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class C146 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int i = n;
        long mx = 0;
        while(i >= 1) {
            int j = i - 1;
            all:while(j >= 1) {
                int k = j - 1;
                while(k >= 1) {
                    if(lcm(i, lcm(j, k)) < mx) break all;
                    //long t = mx;
                    mx = Math.max(mx, lcm(i, lcm(j, k)));
                    //if(t != mx) System.out.println(mx);
                    k--;
                }
                j--;
            }
            i--;
        }
        System.out.println(mx);
    }
    public static long lcm(long a, long b) {
        return a * b / gcd(a, b);
    }
    public static long gcd(long a, long b) {
        if(a == 0) return b;
        return gcd(b % a, a);
    }
}

import java.io.*;
import java.util.*;
import java.math.*;

import static java.lang.Math.*;

public class Main implements Runnable {

    long gcd(long a, long b) {
        while (b != 0) {
            a %= b;
            long temp = a;
            a = b;
            b = temp;
        }
        return a;
    }

    long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }

    void solve() throws Exception {
        long n = sc.nextLong();
        if (n <= 2) {
            out.println(2);
        } else {
            if (n % 2 == 1) {
                out.println(n * (n - 1) * (n - 2));
            } else {
                long ans = (n - 1) * (n - 2) * (n - 3);
                for (int i = 1; i <= n; i++) {
                    ans = max(ans, lcm(i, lcm(n, n - 1)));
                }
                out.println(ans);
            }
        }
    }

    BufferedReader in;
    PrintWriter out;
    FastScanner sc;

    static Throwable uncaught;

    @Override
    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            sc = new FastScanner(in);
            solve();
        } catch (Throwable t) {
            Main.uncaught = t;
        } finally {
            out.close();
        }
    }

    public static void main(String[] args) throws Throwable {
        Thread t = new Thread(null, new Main(), "", 128 * 1024 * 1024);
        t.start();
        t.join();
        if (uncaught != null) {
            throw uncaught;
        }
    }

}

class FastScanner {

    BufferedReader reader;
    StringTokenizer strTok;

    public FastScanner(BufferedReader reader) {
        this.reader = reader;
    }

    public String nextToken() throws IOException {
        while (strTok == null || !strTok.hasMoreTokens()) {
            strTok = new StringTokenizer(reader.readLine());
        }
        return strTok.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

}

import java.util.Scanner;
import java.math.BigInteger;

public class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);

		int x = in.nextInt();

		BigInteger a = BigInteger.valueOf(x);
		BigInteger b = BigInteger.valueOf(x-1);
		BigInteger c = BigInteger.valueOf(x-2);

		System.out.println(a.multiply(b.multiply(c)));
	}
}

import java.util.Scanner;

public class LCMChallenge {
    public static void main(String[] args) {
        Scanner scan =  new Scanner(System.in);
        int n = scan.nextInt();

        if(n<=2){
            System.out.println(n);
            return;
        }

        boolean sieve[] = new boolean[n + 1];
        sieve[0] = false;
        sieve[1] = false;
        for(int i=2;i<=n;i++){
            sieve[i] = true;
        }

        for(int i=2;i<=n;i++){
            int count = i;
            while((int) (i * count) <= n){
                sieve[(int) (i * count)] = false;
                count++;
            }
        }

        long lcm = 0;
        if(sieve[n] || sieve[n-2]){
            lcm = n * (n-1) * (n -2);
        }else if(sieve[n-1]){
            int gPrime = 0;
            for(int i=n-2;i>=0;i--){
                if(sieve[i]){
                    gPrime = i;
                    break;
                }
            }
            lcm = n * (n-1) * gPrime;
        }else{
            int gPrime = 0;
            for(int i=n-1;i>=0;i--){
                if(sieve[i]){
                    gPrime = i;
                    break;
                }
            }
            lcm = n * (n-1) * gPrime;
        }
        System.out.println(lcm);
    }
}

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Queue;
import java.util.TreeMap;
import java.util.TreeSet;

public class LCM235A {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	int mod = (int)(Math.pow(10,9)+7);

	long gcd(long a, long b)
	{
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	public static long lcm_of_array_elements(int[] element_array)
    {
        long lcm_of_array_elements = 1;
        int divisor = 2;

        while (true) {
            int counter = 0;
            boolean divisible = false;

            for (int i = 0; i < element_array.length; i++) {

                // lcm_of_array_elements (n1, n2, ... 0) = 0.
                // For negative number we convert into
                // positive and calculate lcm_of_array_elements.

                if (element_array[i] == 0) {
                    return 0;
                }
                else if (element_array[i] < 0) {
                    element_array[i] = element_array[i] * (-1);
                }
                if (element_array[i] == 1) {
                    counter++;
                }

                // Divide element_array by devisor if complete
                // division i.e. without remainder then replace
                // number with quotient; used for find next factor
                if (element_array[i] % divisor == 0) {
                    divisible = true;
                    element_array[i] = element_array[i] / divisor;
                }
            }

            // If divisor able to completely divide any number
            // from array multiply with lcm_of_array_elements
            // and store into lcm_of_array_elements and continue
            // to same divisor for next factor finding.
            // else increment divisor
            if (divisible) {
                lcm_of_array_elements = lcm_of_array_elements * divisor;
            }
            else {
                divisor++;
            }

            // Check if all element_array is 1 indicate
            // we found all factors and terminate while loop.
            if (counter == element_array.length) {
                return lcm_of_array_elements;
            }
        }
    }

	int d = 0;
	void solve()
	{
		int n = ni();
		if(n<=4) {
			if(n == 1) {
				out.println(1);
				return;
			}
			if(n == 2) {
				out.println(2);
				return;
			}
			if(n == 3) {
				out.println(3);
			}
			if(n == 4) {
				out.println(12);
				return;
			}
		}

			long x = lcm_of_array_elements(new int[]{n,n-1,n-2});
			long y = lcm_of_array_elements(new int[]{n,n-1,n-3});
			long z = lcm_of_array_elements(new int[]{n-3,n-1,n-2});

			out.println(Math.max(Math.max(x, y),z));

	}

	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new LCM235A().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int[][] na(int n , int m)
	{
		int[][] a = new int[n][m];
		for(int i = 0;i < n;i++)
			for(int j = 0 ; j<m ; j++) a[i][j] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	void display2D(int a[][]) {
		for(int i[] : a) {
			for(int j : i) {
				out.print(j+" ");
			}
			out.println();
		}
	}

	int[][] creategraph(int n , int m) {
		int g[][] = new int[n+1][];

		int from[] = new int[m];
		int to[] = new int[m];
		int ct[] = new int[n+1];

		for(int i = 0 ; i<m; i++) {
			from[i] = ni();
			to[i] = ni();
			ct[from[i]]++;
			ct[to[i]]++;
		}

		int parent[] = new int[n+1];

		for(int i = 0 ; i<n+1 ; i++) g[i] = new int[ct[i]];

		for(int i = 0 ; i<m ; i++) {
			g[from[i]][--ct[from[i]]] = to[i];
			g[to[i]][--ct[to[i]]] = from[i];
		}

		return g;
	}

	private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }
}

import java.util.Scanner;
public class Task3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        long res = lcm(n, n-1, n-2);

        System.out.println(res);
    }

    public static long gcd(long a, long b) {
        while (0 != b) {
            long r = a % b;
            a = b;
            b = r;
        }
        return a;
    }

    public static long lcm(long a, long b) {
        return a * b / gcd(a, b);
    }

    public static long lcm (long a, long b, long c) {
        return lcm(lcm(a, b), c);
    }

}

import java.util.*;

public class lcmchallenge {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int bayus = 0;
		if (n == 1) {
			bayus = 1;
		}
		else if (n == 1) {
			bayus = 2;
		}
		else {
			if (n % 2 == 1) {
				bayus = n * (n - 1) * (n - 2);
			}
			else {
				int maxlcm = 0;
				for (int i = n - 2; i >= n / 2; i--) {
					int suhas = GCD(n, i) * GCD (n - 1, i);
					int lcm = n * (n - 1) * i / suhas;
					if (lcm > maxlcm) {
						maxlcm = lcm;
					}
				}
				bayus = maxlcm;
			}
		}
		System.out.println(bayus);
	}

	private static int GCD(int a, int b) {
		if (a > b) {
			return (GCD(a - b, b));
		}
		else if (a < b) {
			return (GCD(a, b - a));
		}
		else {
			return a;
		}
	}

}