#include <bits/stdc++.h>
using namespace std;
int n, i, x[200009], y[200009];

int main () {
cin >> n;
for (i=1; i<=n; i++) {
    cin >> x[i] >> y[i];
}
if (x[1]!=x[2] and y[1]!=y[2])
    cout << 0;
else cout << 1;

return 0;
}