#include <iostream>
using namespace std;
 
int main() {
	unsigned int n, x1, x2, x3, y1, y2, y3, A [4] = {0, 0, 0, 0};
	unsigned long long c = 0;
	cin >> n;
	for (int i = 0; i < n; i ++){
		cin >> x1 >> y1;
		if(x1 % 2 == 0 and y1 % 2 == 0) A [0] ++;
		else if(x1 % 2 == 1 and y1 % 2 == 0) A [1] ++;
		else if(x1 % 2 == 0 and y1 % 2 == 1) A [2] ++;
		else A [3] ++;
	}
	for(int i = 0; i < 4; i ++){
		for(int  j= 0; j < 4; j ++){
			if (i == j) c += A[i] * (A[i] - 1) * (A[i] - 2) / 6;
			else c += A[i] * (A[i] - 1) * A[j] / 2;
		}		
	}
	cout << c;
	return 0;
}