#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 50;
template <typename A, typename B>
istream& operator>>(istream& o, pair<A, B>& a) {
  return o >> a.first >> a.second;
}
template <typename A, typename B>
ostream& operator<<(ostream& o, pair<A, B> a) {
  return o << '(' << a.first << ", " << a.second << ')';
}
long long n, m, q, k, mx;
vector<long long> vc[maxn];
long long dp[maxn], a[maxn], b[maxn];
long long cnt[5][5];
pair<long long, long long> p[maxn];
void solve() {
  long long ans = 0;
  for (long long i = 1; i <= n; i++) cnt[p[i].first % 4][p[i].second % 4]++;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      if (i == j) continue;
      long long a =
          (p[i].first - p[j].first) % 4 | (p[i].second - p[j].second) % 4;
      for (long long ti = 0; ti <= 2; ti += 2) {
        for (long long tj = 0; tj <= 2; tj += 2) {
          long long b = (p[i].first + 4 + ti) % 4 | (p[i].second + 4 + tj) % 4;
          long long c = (p[j].first + 4 + ti) % 4 | (p[j].second + 4 + tj) % 4;
          if ((a + b + c) % 4 == 0) {
            long long t = cnt[ti][tj];
            if (ti == p[i].first % 4 and tj == p[i].second % 4) t--;
            if (ti == p[j].first % 4 and tj == p[j].second % 4) t--;
            ans += t;
          }
        }
      }
    }
  }
  cout << ans / 6 << endl;
}
void input() {
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> p[i];
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  ;
  long long tt;
  input();
  solve();
}
