#include <bits/stdc++.h>
using namespace std;
int n = 0, x[6001] = {0}, y[6001] = {0}, num[2][2] = {0};
long long ans = 0;
int gcd(int a, int b) {
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
int abs(int x) { return x > 0 ? x : -x; }
long long C(long long n, long long m) {
  if (m > n) return 0;
  if (m == 0)
    return 1;
  else
    return C(n - 1, m - 1) * n / m;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x[i], &y[i]);
    x[i] = x[i] / 2 % 2;
    y[i] = y[i] / 2 % 2;
    num[x[i]][y[i]]++;
  }
  int p[3], x[3], y[3];
  for (p[0] = 0; p[0] < 4; p[0]++) {
    for (p[1] = 0; p[1] < 4; p[1]++) {
      for (p[2] = 0; p[2] < 4; p[2]++) {
        if (p[0] <= p[1] && p[1] <= p[2]) {
          for (int i = 0; i < 3; i++) {
            x[i] = p[i] % 2;
            y[i] = p[i] / 2;
          }
          int s = 0, b[4] = {0};
          long long v = 1;
          for (int i = 0; i < 3; i++) {
            s += (abs(x[i] - x[(i + 1) % 3]) || abs(y[i] - y[(i + 1) % 3]));
          }
          if (s % 2 == 0) {
            for (int i = 0; i < 3; i++) {
              b[p[i]]++;
            }
            for (int i = 0; i < 4; i++) {
              v *= C(num[i % 2][i / 2], b[i]);
            }
            ans += v;
          }
        }
      }
    }
  }
  printf("%lld\n", ans);
}
