#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  long long f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
int cnt[3][3];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    ++cnt[x % 4][y % 4];
  }
  long long ans = 1LL * n * (n - 1) * (n - 2) / 6;
  ans -= 1LL * cnt[0][0] * cnt[0][2] * cnt[2][0];
  ans -= 1LL * cnt[0][0] * cnt[0][2] * cnt[2][2];
  ans -= 1LL * cnt[0][0] * cnt[2][0] * cnt[2][2];
  ans -= 1LL * cnt[0][2] * cnt[2][0] * cnt[2][2];
  cout << ans;
  return 0;
}
