import java.util.Scanner;

public class Jag {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		if (N > 8) {
			if (N % 2 == 0) {
				System.out.println(N - 2);
			} else {
				System.out.println(N - 1);
			}
		} else if (N > 4 && N < 9) {
			System.out.println(N - 1);

		} else {
			System.out.println(1);
		}

	}
}