var b,c:array[1..100000] of integer;
i,dem,n,j:integer;
begin
read(n);
j:=1;
for i:=1 to n do
begin
read(b[j]);
read(c[j[);
inc(j);
readln;
end;
dem:=0;
n:=j-1;
for i:=1 to n-1 do
begin
for j:=i+1 to n do
if (b[i] = b[j]) and (c[i] <> c[j]) then
begin
inc(dem);
c[j]:=c[i];
end;
end;
write(dem);
readln;
end.
@hoangduy67