#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
const long long N = 6010, mod = 998244353;
bool f[N][N];
long long n, x[N], y[N], ans1, ans2, tot;
long long sum[2][2];
int main() {
  n = read();
  for (long long i = (long long)(1); i <= (long long)(n); ++i)
    x[i] = read() / 2, y[i] = read() / 2;
  for (long long i = (long long)(1); i <= (long long)(n); ++i) {
    sum[0][0] = sum[0][1] = sum[1][0] = sum[1][1] = 0;
    for (long long j = (long long)(1); j <= (long long)(n); ++j)
      if (j != i) ++sum[abs(x[j] - x[i]) & 1][abs(y[j] - y[i]) & 1];
    ans1 += sum[1][0] * (sum[1][0] - 1) / 2;
    ans1 += sum[0][1] * (sum[0][1] - 1) / 2;
    ans1 += sum[1][1] * (sum[1][1] - 1) / 2;
    ans2 += sum[0][0] * (sum[0][0] - 1) / 2;
  }
  cout << ans1 + ans2 / 3 << endl;
}
