#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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCmludCBtYWluKCkgewoJdW5zaWduZWQgaW50IG4sIHgxLCB4MiwgeDMsIHkxLCB5MiwgeTMsIEEgWzRdID0gezAsIDAsIDAsIDB9OwoJdW5zaWduZWQgbG9uZyBsb25nIGMgPSAwOwoJY2luID4+IG47Cglmb3IgKGludCBpID0gMDsgaSA8IG47IGkgKyspewoJCWNpbiA+PiB4MSA+PiB5MTsKCQlpZih4MSAlIDIgPT0gMCBhbmQgeTEgJSAyID09IDApIEEgWzBdICsrOwoJCWVsc2UgaWYoeDEgJSAyID09IDEgYW5kIHkxICUgMiA9PSAwKSBBIFsxXSArKzsKCQllbHNlIGlmKHgxICUgMiA9PSAwIGFuZCB5MSAlIDIgPT0gMSkgQSBbMl0gKys7CgkJZWxzZSBBIFszXSArKzsKCX0KCWZvcihpbnQgaSA9IDA7IGkgPCA0OyBpICsrKXsKCQlmb3IoaW50ICBqPSAwOyBqIDwgNDsgaiArKyl7CgkJCWlmIChpID09IGopIGMgKz0gQVtpXSAqIChBW2ldIC0gMSkgKiAoQVtpXSAtIDIpIC8gNjsKCQkJZWxzZSBjICs9IEFbaV0gKiAoQVtpXSAtIDEpICogQVtqXSAvIDI7CgkJfQkJCgl9Cgljb3V0IDw8IGM7CglyZXR1cm4gMDsKfQ==