import java.util.Scanner;

/**
 * HJ53 杨辉三角的变形 - 简单
 */
public class HJ053 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] num = {2, 3, 2, 4};
        while (sc.hasNext()) {
            int n = sc.nextInt();
            if (n < 3) {
                System.out.println(-1);
            } else {
                System.out.println(num[(n - 3) % 4]);
            }
        }
        sc.close();
    }
}