#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;



//MAIN PROGRAM BODY
int main()
{    
    //File I/O declarations
    ofstream fout ("OUT3.txt");
    ifstream fin ("DATA3.txt");
    
    int i, j, k; 
    int buffer1, buffer2, buffer3, buffer4;   
    int number;
    int factors = 0;
    int ones;
    
    for (i = 0; i < 5; ++i)
    {
        fin >> number;
        ones = 0;
        while (number > 0)
        {
              if (number & 1 == 1)
                 ones++;
              number >>= 1;
        }
        fout << ones % 2 << "\n";
    }                 


                 
    
    return 0;    
}

