#include <bits/stdc++.h>
using namespace std;
pair<int, int> points[1000000];
long long int arr[2][2];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> points[i].first >> points[i].second;
  }
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      arr[i][j] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    arr[(points[i].first / 2) % 2][(points[i].second / 2) % 2]++;
  }
  long long int ans = 0;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      ans += (arr[i][j] * (arr[i][j] - 1) * (arr[i][j] - 2)) / 6;
      ans += (n - arr[i][j]) * (arr[i][j] * (arr[i][j] - 1)) / 2;
    }
  }
  cout << ans << endl;
  return 0;
}
