#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000009LL;
const long long MOD = 1000000007LL;
long long n;
long long cnt[4][4];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    long long x, y;
    cin >> x >> y;
    cnt[x % 4][y % 4] += 1;
  }
  long long ans = 0;
  for (long long i = 0; i < 4; ++i)
    for (long long j = 0; j < 4; ++j)
      ans += cnt[i][j] * (cnt[i][j] - 1) / 2 * (n - cnt[i][j]);
  for (long long i = 0; i < 4; ++i)
    for (long long j = 0; j < 4; ++j)
      ans += cnt[i][j] * (cnt[i][j] - 1) * (cnt[i][j] - 2) / 6;
  cout << ans;
}
