#include <stdio.h>
#include <stdlib.h>
int Result(int i);
int main()
{
    int n,y,e=1,n1;
    printf("input n:");
    scanf("%d",&n);
    n1=n;
    y=Result(e);
    n=n-1;
    while(n!=0)
    {
        if(y!=0)
        {
            y=Result(y);
            n--;
        }
        else
        {
            e++;
            y=Result(e);
            n=n1-1;
        }
    }
    printf("%d",y);
    return 0;
}
int Result(int i)
{
    int ret;
    ret=(5*i+1)%4;
    if(ret==0)
    {
        ret=(5*i+1)/4;
        return ret;
    }
    return 0;
}