#include<iostream>
#include<string>
using namespace std;
int main(int argc,char* argv[])
{
    int nRow=0;
    while(cin>>nRow)
    {
        int res=-1;
        int myInt[]={4,2,3,2};
        if(nRow>2)
            res=myInt[(nRow-2)%4];
        cout<<res<<endl;
    }
    return 0;
}
//分析思路:
//                                          1
//                                     1    1    1
//                                1    2    3      2      1
//                           1    3    6     7     6      3    1
//                      1    4    10   16    19    16    10    4    1
//                  1   5    15   30   45    51    45    30    15    5    1
//              1   6   21   50   90   126   141   126   90    50    21   6    1
//          1   7   28  77
//      1   8   36  112
//  1   9   51  156
//  10  
//通过以上的数据分析规律为 {-1,-1,2,3,2,4,2,3,2,4,...}