num = int(input())
array1 = []
sum1 = 0
sum2 = 0
for i in range(num, 0, -1):
if sum1 <= sum2:
sum1 += i
array1.append(i)
else:
sum2 += i
print(abs(sum2 - sum1))
print(len(array1), end=" ")
for i in array1:
print(i, end=" ")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll z;
vector<ll>arr;
int main()
{
ll n;
cin>>n;
if((n*(n+1)/2)%2==0&&n!=2)
cout<<"0"<<endl;
else
cout<<"1"<<endl;
z=n*(n+1)/4;
for(ll i=n;i>0;i--)
{
if(z-i>=0)
{
arr.push_back(i);
z-=i;
}
else if(z==0)
break;
}
cout<<arr.size()<<" ";
for(ll i=0;i<arr.size();i++)
cout<<arr[i]<<" ";
}
60. Permutation Sequence | 42. Trapping Rain Water |
32. Longest Valid Parentheses | Cutting a material |
Bubble Sort | Number of triangles |
AND path in a binary tree | Factorial equations |
Removal of vertices | Happy segments |
Cyclic shifts | Zoos |
Build a graph | Almost correct bracket sequence |
Count of integers | Differences of the permutations |
Doctor's Secret | Back to School |
I am Easy | Teddy and Tweety |
Partitioning binary strings | Special sets |
Smallest chosen word | Going to office |
Color the boxes | Missing numbers |
Maximum sum | 13 Reasons Why |
Friend's Relationship | Health of a person |