type
rec=record
s:integer;
t:integer;
end;
var
a:array[1..200000] of rec;
i,j,n,k,l,p,sum:longint;
begin
sum:=0;
readln(n,k,p);
for i:=1 to n do
readln(a[i].s,a[i].t);
for j:=1 to n-1 do
for l:=j+1 to n do
if a[j].s=a[l].s then
for j:=l to i do
if a[j].t<=p then
begin
sum:=sum+1;
break;
end;
end;
writeln(sum);
readln;
end.