#include <iostream>
/*
1
1 1 1
1 2 3 2 1
1 3 6 7 6 3 1
1
1 1
1 0 1 2
1 1 0 1 3
1 0 0 0 1 2
1 1 1 0 1 1 4
1 0 1 0 0 0 1 2
1 1 0 1 1 0 1 1 3
1 0 0 0 0 0 0 0 1 2
1 1 1 0
*/
int f(const int n){
if(n <= 2){return -1;}
int m = (n - 2) % 4;
switch(m){
case 1:
case 3:
return 2;
case 2:
return 3;
case 0:
return 4;
default:
break;
}
return -1;
}
int main(){
int n;
while(std::cin >> n){
std::cout << f(n) << std::endl;
}
return 0;
} 


京公网安备 11010502036488号