#include <bits/stdc++.h>
using namespace std;
const int maxn = 500010, inf = 1e9 + 233;
template <typename T>
inline void read(T &k) {
  int f = 1;
  k = 0;
  char c = getchar();
  while (c < '0' || c > '9') c == '-' && (f = -1), c = getchar();
  while (c <= '9' && c >= '0') k = k * 10 + c - '0', c = getchar();
  k *= f;
}
int n;
int x[maxn], y[maxn];
int main() {
  read(n);
  for (int i = 1; i <= n; i++) read(x[i]), read(y[i]);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0;
    for (int j = 1; j <= n; j++)
      if (i != j) {
        int x2 = abs(x[i] - x[j]), y2 = abs(y[i] - y[j]);
        x2 /= 2;
        y2 /= 2;
        if (x2 & 1) {
          if (y2 & 1)
            cnt4++;
          else
            cnt3++;
        } else {
          if (y2 & 1)
            cnt2++;
          else
            cnt1++;
        }
      }
    ans += 1ll * cnt1 * (cnt1 - 1) / 2 + 1ll * (cnt2 - 1) * cnt2 / 2 +
           1ll * (cnt3 - 1) * cnt3 / 2 + 1ll * (cnt4 - 1) * cnt4 / 2 +
           1ll * cnt1 * (cnt2 + cnt3 + cnt4);
  }
  printf("%lld\n", ans / 3);
}
