#include <bits/stdc++.h>
using namespace std;
unsigned seed = chrono::system_clock::now().time_since_epoch().count();
mt19937 ran(seed);
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
clock_t start = clock();
long long int gcd(long long int a, long long int b) {
  return (a == 0) ? b : gcd(b % a, a);
}
long long int power(long long int a, long long int n) {
  long long int p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
    }
    n >>= 1;
    a *= a;
  }
  return p;
}
long long int powm(long long int a, long long int n, long long int mod_) {
  long long int p = 1;
  while (n) {
    if (n % 2) {
      p = (((p % mod_) * 1LL * (a % mod_)) % mod_);
    }
    n >>= 1;
    a = (((a % mod_) * 1LL * (a % mod_)) % mod_);
  }
  return p % mod_;
}
long long int powi(long long int a, long long int mod_) {
  return powm(a, mod_ - 2, mod_);
}
void pre();
long long int nc3(long long int n) { return n * (n - 1) * (n - 2) / 6; }
void test_case() {
  long long int mn, mx;
  long long int i, j, k, l, r;
  long long int n, m, x, y, z;
  long long int sum = 0, cnt = 0;
  cin >> n;
  int a[n][2];
  long long int b[4] = {0, 0, 0, 0};
  for (i = 0; i < n; ++i) {
    cnt = 0;
    for (j = 0; j < 2; ++j) {
      cin >> a[i][j];
      a[i][j] /= 2;
      cnt += (j + 1) * (a[i][j] % 2);
    }
    ++b[cnt];
  }
  for (i = 0; i < 4; ++i) {
    sum += nc3(b[i]);
    sum += b[i] * (b[i] - 1) / 2 * (n - b[i]);
  }
  cout << sum;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TC = 1, tc = 0;
  pre();
  while (tc++ < TC) {
    test_case();
    cout << '\n';
  };
  return 0;
}
void pre() { return; }
