#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long N;
  cin >> N;
  vector<pair<long long, long long>> vect;
  auto f = [&](long long a, long long b) {
    long long x = abs(vect[a].first - vect[b].first) % 2;
    long long y = abs(vect[a].second - vect[b].second) % 2;
    if (x == 0 && y == 0) return 0;
    return 1;
  };
  auto get = [&](long long x) {
    return (pair<long long, long long>){vect[x].first % 2, vect[x].second % 2};
  };
  for (long long i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    vect.push_back({a / 2, b / 2});
  }
  long long res1 = 0;
  long long res2 = 0;
  for (long long i = 0; i < N; i++) {
    long long t1[2][2];
    long long t2[2][2];
    for (long long x = 0; x < 2; x++) {
      for (long long y = 0; y < 2; y++) {
        t1[x][y] = 0;
        t2[x][y] = 0;
      }
    }
    for (long long j = 0; j < N; j++) {
      if (i == j) continue;
      if (f(i, j) == 0) {
        long long x, y;
        tie(x, y) = get(j);
        t1[x][y]++;
      } else {
        long long x, y;
        tie(x, y) = get(j);
        t2[x][y]++;
      }
    }
    for (long long x = 0; x < 2; x++) {
      for (long long y = 0; y < 2; y++) {
        res1 += t1[x][y] * (t1[x][y] - 1) / 2;
        res2 += t2[x][y] * (t2[x][y] - 1) / 2;
      }
    }
  }
  cout << res2 + res1 / 3 << '\n';
  return 0;
}
