#include<stdio.h>
int main(){
    int n,pos,arr[4] = {2,3,2,4};//当n>2时,偶数出现的位置分别是:2 3 2 4循环
    scanf("%d",&n);
    if(n <= 2){
        pos = -1;
    }else{
        n=(n-3)%4;
        pos = arr[n];
    }
    printf("%d\n",pos);
    return 0;
}