#include <bits/stdc++.h>
using namespace std;
int t[200000], x[200000], y[200000];
int main() {
  int N, ans = 0, countX, countT;
  x[0] = 0;
  y[0] = 0;
  t[0] = 0;
  cin >> N;
  for (int i = 1; i < N + 1; i++) {
    cin >> t[i] >> x[i] >> y[i];
  }
  for (int i = 1; i < N + 1; i++) {
    countX = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
    countT = t[i] - t[i - 1];
    if (countX > countT) {
      ans = 1;
      break;
    } else if ((countT - countX) % 2 == 1) {
      ans = 1;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
