#include <bits/stdc++.h>
using namespace std;
const int MAXN = 6 * 1050;
int n;
int x[MAXN], y[MAXN];
int xmd4[MAXN], ymd4[MAXN];
int cnt[4][4];
long long ans = 0;
long long fours = 0, fourTwos = 0;
void add(int pos) { cnt[xmd4[pos]][ymd4[pos]]++; }
void rmv(int pos) { cnt[xmd4[pos]][ymd4[pos]]--; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &x[i], &y[i]);
    xmd4[i] = x[i] % 4;
    ymd4[i] = y[i] % 4;
    add(i);
  }
  for (int i = 0; i < n; i++) {
    rmv(i);
    for (int j = 0; j < n; j++) {
      if (j == i) continue;
      rmv(j);
      if (xmd4[i] == xmd4[j] && ymd4[i] == ymd4[j]) {
        for (int ii = 0; ii < 4; ii += 2)
          for (int jj = 0; jj < 4; jj += 2) {
            int fi = (ii == xmd4[i]) && (jj == ymd4[i]);
            int fj = (ii == xmd4[j]) && (jj == ymd4[j]);
            if (fi == 1 && fj == 1)
              fours += cnt[ii][jj];
            else if (fi == 0 && fj == 0)
              fourTwos += cnt[ii][jj];
          }
      }
      add(j);
    }
    add(i);
  }
  ans = fours / 6 + fourTwos / 2;
  cout << ans << endl;
  return 0;
}
