#include <fstream>

using namespace std;

ifstream in("DATA3.txt");
ofstream out("OUT3.txt"); 

int main(){
    
    int userNum[5];
    for (int i = 0; i < 5; i++){
        in >> userNum[i];
        }
		
		//////////////////////////////////////////////////
		int highBits=0;
		for(int line = 0; line < 5; line++){
            while(userNum[line]!=0)
		        {
		        	if(userNum[line]%2 == 1)
			{
				highBits++;
			}
			
			userNum[line] /= 2;
			
		}
        if(highBits%2 == 0) out << "0"<<endl;
		else  out << "1" << endl;
		highBits = 0;
    }
		
		///////////////////////////////////////////////////////////////////
		
		
}

