program newarea;
const max=200;
type square=record
            x1,y1,x2,y2:integer;
            end;
     dat=array[1..max] of square;
     mat=array[1..max,1..max] of byte;
var a:mat;
    s:dat;
    n,i,j,k,res,sum:integer;

function re(z1,z2:square):byte;
 var c,x1,y1,x2,y2,x3,y3,x4,y4,s:integer;
begin
x1:=z1.x1; y1:=z1.y1;
x2:=z1.x2; y2:=z1.y2;
x3:=z2.x1; y3:=z2.y1;
x4:=z2.x2; y4:=z2.y2;

   if x1>x2 then begin c:=x1; x1:=x2; x2:=c; end;
   if y1>y2 then begin c:=y1; y1:=y2; y2:=c; end;
   if x3>x4 then begin c:=x3; x3:=x4; x4:=c; end;
   if y3>y4 then begin c:=y3; y3:=y4; y4:=c; end;
   if (x1>x4)or(x2<x3)or(y1>y4)or(y2<y3)
      then s:=0
      else if ( (x1=x4)or(x2=x3) )and( (y1=y4)or(y2=y3) )
                then s:=1
                else if (x1=x4)or(x2=x3)or(y1=y4)or(y2=y3)
                       then s:=2
                       else s:=3;
re:=s;
end;

begin
{assign(INPUT,'input.txt');
reset(input);}
read(n);
for i:=1 to n do
    begin
    with s[i] do
         read(x1,y1,x2,y2);
    end;
fillchar(a,sizeof(a),0);
for i:=1 to n do
  for j:=1 to n do
      begin
      if re(s[i],s[j])>0
         then begin
              a[i,j]:=1;
              a[j,i]:=1;
              end;
      end;
for k:=1 to n do
  for i:=1 to n do
    for j:=1 to n do
        if a[i,k]*a[k,j]>0
           then begin
                a[i,j]:=1;
                end;
res:=0;
for i:=1 to n do
    begin
    sum:=0;
    for j:=1 to n do
        inc(sum,a[i,j]);
    if res<sum
       then res:=sum;
    end;
writeln(res);
end.