#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
const ll MOD = 1e9+7;

int main(){
  ll n;
  cin>>n;
  if(n==0)cout<<1;
  else if(n==1)cout<<2;
  else if(n==2)cout<<1;
  else cout<<0;
  cout<<endl;
  return 0;
}

