#include <bits/stdc++.h>

using namespace std;

namespace {

    typedef long long ll;

    int N;
    void input() {
        cin >> N;
    }

    void solve() {
        if (N == 0) cout << 1 << endl;
        else if (N == 1) cout << 2 << endl;
        else if (N == 2) cout << 1 << endl;
        else cout << 0 << endl;
    }
}

int main() {
    input(); solve();
    return 0;
}