#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;

int main()
{
ll n ;
cin >> n  ;
ll v[1002][1002]={};
rep(i,n){
  ll l , r ;
  cin >> l >> r ;
  ll x , y ;
  cin >> x >> y ;
  v[l][r]++;
  v[x][y]++;
  v[l][y]--;
  v[x][r]--;
}
rep(i,1001){
  ll te=v[i][0];
  rep(j,1001){
    te+=v[i][j+1];
    v[i][j+1]=te;
  }
}
rep(i,1001){
  ll te=v[0][i];
  rep(j,1001){
    te+=v[j+1][i];
    v[j+1][i]=te;
  }
}
rep(i,1002)rep(j,1002){
  ans=max(ans,v[i][j]);
}

cout << ans << endl;
return 0;
}
