program Project1;
var
  c:array[1..3] of char;
  a,b:array[1..100] of integer;
  n,i,p:integer;

begin
  readln(n);
  p:=0;
  for i:=1 to n-1 do readln (A[i],B[i],C[i]);
  for i:=1 to n-1 do if (a[i]<b[i]) then if (a[i]<=1) then if (b[i]<=n) then p:=p+1;
  writeln(p);
  readln;
end.