program Project2; {$APPTYPE CONSOLE} Type tpoint= record a,b:integer; end; tmass= array [0..10000] of tpoint; var c: tmass; i,j,n,k : integer; p: boolean; begin { TODO -oUser -cConsole Main : Insert code here } assign( input,'task.in'); reset(input); readln(n); for i:=1 to n do read(c[i].a,c[i].b); assign(output,'task.out'); rewrite(output); p:= false; for i:=1 to n-1 do for j:=i+1 to n do begin if (((c[i].a<=c[j].a) and (c[i].b<=c[j].b)) or((c[i].b<=c[j].a) and (c[i].a<=c[j].b)) or((c[i].a<=c[j].b) and (c[i].b<=c[j].a))) or (((c[i].a>=c[j].a) and (c[i].b>=c[j].b)) or((c[i].b>=c[j].a) and (c[i].a>=c[j].b)) or((c[i].a>=c[j].b) and (c[i].b>=c[j].a))) then p:= true else p:= false; if p= true then inc(k); end; if p= true then inc(k); writeln(4); end.