异或约数和

f(1) = 1
f(2) = 1 xor 2 = 3
f(3) = 1 xor 3 = 2
f(4) = 1 xor 2 xor 4 = 7
1 xor 3 xor 2 xor 7 = 7

0^0=0
1^0=1
1^1=0
A^0=A
A^A=0

f(1, n)  =
f(0, n)  =
n  		n % 4 == 0
1  		n % 4 == 1
n +1   	n % 4 == 2
0     	n % 4 == 3
inline int Sigxor( int n )
{
return ((n%4)&1) ? ((n%4)>>1)^1 : ((n%4)>>1)^n ;
}

#include <bits/stdc++.h>
#define N 100050
#define lodou long double
#define lll __int128
#define INmF 0x3f3f3f3f
#define lbt(x) (x&(-x))
#define mes(a,b) memset(a,b,sizeof(a))
#define qwq(a,b) for(int i=a ;i<=b;++i)
#define qeq(a,b) for(int j=a ;j<=b;++j)
#define qaq(a,b,c) for(ll i=a ; i<=b ;i=c+1)
#define IOS ios::sync_with_stdio(false)
#define  UPCASE( c ) ( ((c) >= 'c' && (c) <= 'z') ? ((c) - 0x20) : (c) )
using namespace std;
const double Eps = 1e-8 ;
const double pi  = acos(-1) ;
const long long mod = 1e9+7 ;
typedef long long int ll;
inline ll pow_mod (ll a,ll b) {ll res=1;a%=mod; if(b<0) return -1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline ll fas_mul (ll a,ll b) { return ( (a*b-(ll)(((long double)a*b+0.5)/mod)*mod)%mod+mod)%mod ; }

namespace io {

#define out(a) write(a)
#define outn(a) out(a),putchar('\n')

#define I_int __int128
I_int x = 0 , f = 1 ; char c = getchar() ;
while( c < '0' || c > '9' ) { if( c == '-' ) f = -1 ; c = getchar() ; }
while( c >= '0' && c <= '9' ) { x = x * 10 + c - '0' ; c = getchar() ; }
return x * f ;
}
char F[ 200 ] ;
inline void write( I_int x ) {
if( x == 0 ) { putchar( '0' ) ; return ; }
I_int tmp = x > 0 ? x : -x ;
if( x < 0 ) putchar( '-' ) ;
int cnt = 0 ;
while( tmp > 0 ) {
F[ cnt ++ ] = tmp % 10 + '0' ;
tmp /= 10 ;
}
while( cnt > 0 ) putchar ( F[ -- cnt ] ) ;
}
#undef I_int

}using namespace io ;
//ouououououououououououououououououououououououououououououououououououououououououououououououou

inline ll Sigxor( ll n )
{	return ((n%4)&1) ? ((n%4)>>1)^1 : ((n%4)>>1)^n ;	}

ll Blocking( ll n )
{
ll 	res=0 ,
tem=0 ;
qaq( 1 , n , tem ){
tem=n/(n/i) ;//分块
if( (n/i)&1 )
res^=Sigxor(i-1)^Sigxor(tem);//i~tem段的异或和
}
return res ;
}
unsigned main()
{
outn(Blocking(n));
}