#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
typedef long long ll;
typedef long double ld;
long long dx[] = {1,0,-1,0};
long long dy[] = {0,1,0,-1};
long long dx8[] = {1,1,0,-1,-1,-1,0,1};
long long dy8[] = {0,1,1,1,0,-1,-1,-1};
long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};

signed main(){
    ll N;
    cin >> N;
    ll imos[1001][1001];
    FOR(i,0,1001)FOR(j,0,1001)imos[i][j] = 0;
    FOR(i,0,N){
        ll a,b,c,d;
        cin >> a >> b >> c >> d;
        imos[a][b]++;
        imos[c][b]--;
        imos[a][d]--;
        imos[c][d]++;
    }
    FOR(j,0,1001)FOR(i,1,1001){
        imos[i][j] += imos[i-1][j];
    }
    FOR(i,0,1001)FOR(j,1,1001){
        imos[i][j] += imos[i][j-1];
    }
    ll ans = 0;
    FOR(i,0,1001)FOR(j,0,1001)ans = max(ans,imos[i][j]);
    cout << ans << endl;
}
