#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long cnt[4][4] = {};
  for (long long i = 1; i <= n; i++) {
    long long first, second;
    cin >> first >> second;
    cnt[first % 4][second % 4]++;
  }
  cout << (cnt[0][0] * (cnt[0][0] - 1) * (cnt[0][0] - 2) / 6 +
           cnt[0][0] * (cnt[0][0] - 1) / 2 * cnt[0][2] +
           cnt[0][0] * (cnt[0][0] - 1) / 2 * cnt[2][0] +
           cnt[0][0] * (cnt[0][0] - 1) / 2 * cnt[2][2] +
           cnt[0][2] * (cnt[0][2] - 1) / 2 * cnt[0][0] +
           cnt[2][0] * (cnt[2][0] - 1) / 2 * cnt[0][0] +
           cnt[2][2] * (cnt[2][2] - 1) / 2 * cnt[0][0] +
           cnt[0][2] * (cnt[0][2] - 1) * (cnt[0][2] - 2) / 6 +
           cnt[0][2] * (cnt[0][2] - 1) / 2 * cnt[2][0] +
           cnt[0][2] * (cnt[0][2] - 1) / 2 * cnt[2][2] +
           cnt[2][0] * (cnt[2][0] - 1) / 2 * cnt[0][2] +
           cnt[2][2] * (cnt[2][2] - 1) / 2 * cnt[0][2] +
           cnt[2][0] * (cnt[2][0] - 1) * (cnt[2][0] - 2) / 6 +
           cnt[2][0] * (cnt[2][0] - 1) / 2 * cnt[2][2] +
           cnt[2][2] * (cnt[2][2] - 1) / 2 * cnt[2][0] +
           cnt[2][2] * (cnt[2][2] - 1) * (cnt[2][2] - 2) / 6);
}
