#include<iostream>
#include<cstdio>
using namespace std;
long long n,ans=0;
long long q(long long a)
{
if(a%4==0) return a;
if(a%4==1) return 1;
if(a%4==2) return a+1;
if(a%4==3) return 0;
}
int main()
{
freopen("xoradd.in","r",stdin);
freopen("xoradd.out","w",stdout);
scanf("%lld",&n);
long long l=1;
while(l<=n)
{
long long x=n/l;
long long r=n/x;
if(x&1==1)
{
ans=ans^q(l-1)^q(r);
}
l=r+1;
}
printf("%lld",ans);
return 0;
}