Program Triangle;

Var f: Text;
    n: LongInt;  // points amount
    x, y: LongInt; //coordinates
    kind: Array [0..1, 0..1] of Int64;
    result: Int64;
    i: LongInt;
    ax, ay, bx, by, cx, cy: ShortInt;
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;
  {Result evaluation}
  result:= 0;
  For ax:= 0 To 1 Do Begin
    For ay:= 0 To 1 Do Begin
      For bx:= 0 To 1 Do Begin
        For by:= 0 To 1 Do Begin
          For cx:= 0 To 1 Do Begin
            For cy:= 0 To 1 Do Begin
              If not Odd(bx*cy-by*cx+ax*by-ay*bx+cx*ay-cy*ax) Then Begin
              {The sum is even}
                If (ax=bx) and (ay=by) and (ax=cx) and (ay=cy) Then Begin
                  {three vertices of the one kind}
                  result:= result+kind[ax,ay]*(kind[ax,ay]-1)*(kind[ax,ay]-2);
                End Else
                If (ax=bx) and (ay=by) Then Begin
                  {the vertices a and b are belong to one kind, á to the other}
                  result:= result+kind[ax,ay]*(kind[ax,ay]-1)*kind[cx,cy];
                End Else
                If (ax=cx) and (ay=cy) Then Begin
                  {the vertices a and c are belong to one kind, b to the other}
                  result:= result+kind[ax,ay]*kind[bx,by]*(kind[cx,cy]-1);
                End Else
                If (bx=cx) and (by=cy) Then Begin
                  {the vertices b and c are belong to one kind, a to the other}
                  result:= result+kind[ax,ay]*kind[bx,by]*(kind[cx,cy]-1);
                End Else
                Begin
                  {all points in pairs are belong to the different kinds}
                  result:= result+kind[ax,ay]*kind[bx,by]*kind[cx,cy];
                End;
              End;
            End;
          End;
        End;
      End;
    End;
  End;
  {Each triange is counted 6 times}
  result:= result div 6;
  {Output}
//  Assign(f, 'triangle.out'); Rewrite(f);
  Writeln(result);
  //Close(f);
End.
