Description
You are given an integer sequence 1,2,…,n. You have to divide it into two sets A and Bin such a way that each element belongs to exactly one set and |sum(A)−sum(B)|
is minimum possible.
The value |x|is the absolute value of x and sum(S)is the sum of elements of the set S.
Input
The first line of the input contains one integer n(1≤n≤2⋅109).
Output
Print one integer — the minimum possible value of |sum(A)−sum(B)|
if you divide the initial sequence 1,2,…,ninto two sets Aand B.
Sample Input
Input
3
Output
0
Input
5
Output
1
Input
6
Output
1
#include<stdio.h>
long f(long n)
{
long sum=0;
while(n>0)
{
sum+=n;
n=n-1;
}
return sum;
}
int main()
{
long n,t;
scanf("%ld",&n);
t=f(n);
if(t%2==0)
printf(“0”);
else
printf(“1”);
return 0;
}