#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chkmin(T &first, T second) {
  return second < first ? first = second, 1 : 0;
}
template <typename T>
bool chkmax(T &first, T second) {
  return first < second ? first = second, 1 : 0;
}
template <typename T>
void readint(T &first) {
  first = 0;
  int f = 1;
  char c;
  for (c = getchar(); !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) first = first * 10 + (c - '0');
  first *= f;
}
const int MOD = 1000000007, INV3 = (MOD + 1) / 3;
inline int dmy(int first) { return first >= MOD ? first - MOD : first; }
inline void inc(int &first, int second) { first = dmy(first + second); }
int qmi(int first, int second) {
  int ans = 1;
  for (; second; second >>= 1, first = 1ll * first * first % MOD)
    if (second & 1) ans = 1ll * ans * first % MOD;
  return ans;
}
const int MAXN = 6005;
int n;
int cnt[4][4];
int main() {
  readint(n);
  for (int i = 1, first, second; i <= n; ++i)
    readint(first), readint(second), ++cnt[first & 3][second & 3];
  long long res = 0;
  for (int i = 0; i <= 3; ++i)
    for (int j = 0; j <= 3; ++j)
      res += 1ll * cnt[i][j] * (cnt[i][j] - 1) / 2 * (n - cnt[i][j]) +
             1ll * cnt[i][j] * (cnt[i][j] - 1) * (cnt[i][j] - 2) / 6;
  cout << res << endl;
  return 0;
}
