Program Triangle;

Var f: Text;
    n: Int64;  // points amount
    x, y: LongInt; //coordinates
    kind: Array [0..1, 0..1] of Int64;
    result: Int64;
    i: LongInt;
Begin
  {Read datum; points distributing and count}
//  Assign(f, 'triangle.in'); Reset(f);
  Readln(n);
  FillChar(kind, SizeOf(kind), 0);
  For i:= 1 To n Do Begin
    Readln(x, y);
    Inc(kind[x and 1, y and 1]);
  End;
//  Close(f);
  {Result evaluation}
  result:= n*(n-1)*(n-2) div 6 -
           kind[0,0]*kind[0,1]*kind[1,0]-
           kind[0,0]*kind[0,1]*kind[1,1]-
           kind[0,0]*kind[1,0]*kind[1,1]-
           kind[0,1]*kind[1,0]*kind[1,1];
  {Output}
  //Assign(f, 'triangle.out'); Rewrite(f);
  Writeln(result);
//  Close(f);
End.
