#include <bits/stdc++.h> using namespace std; int main(){ int a,s; cin>>a; s=a%4; if(s==0){ cout<<4<<endl; }else{ cout<<4-s<<endl; } }