#include<bits/stdc++.h>
using namespace std;
int  main() {
    long long n, m;
    cin >> m >> n;
    for(int i = 0 ; i < n; i++){
        int a1, b1;
        cin >> a1 >> b1;
    }
    cout << n%2 << "\n";



    return 0;
}

