#include <bits/stdc++.h>
using namespace std;
long long n, quant[4][4];
void solve() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long x, y;
    cin >> x >> y;
    x %= 4;
    y %= 4;
    x /= 2;
    y /= 2;
    quant[x][y]++;
  }
  long long ans0 = 0, ans2 = 0;
  for (long long i = 0; i < 2; i++)
    for (long long j = 0; j < 2; j++) {
      ans0 += (quant[i][j] - 2) * (quant[i][j] - 1) * quant[i][j] / 6;
    }
  for (long long i = 0; i < 2; i++)
    for (long long j = 0; j < 2; j++) {
      for (long long ii = 0; ii < 2; ii++)
        for (long long jj = 0; jj < 2; jj++) {
          if (i == ii and j == jj) continue;
          ans2 += quant[i][j] * (quant[ii][jj] - 1) * quant[ii][jj] / 2;
        }
    }
  cout << ans0 + ans2 << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
