#include <bits/stdc++.h>
using namespace std;
using ll = long long;

/////////////////////////////////////////////////////////////////////////////////

template<typename T>
struct CumlativeSum2D {
    int N,M;
    vector<vector<T>> arr;

    CumlativeSum2D (vector<vector<T>> &A) {
        N = A.size();
        A.emplace_back();
        M = A[0].size();
        A.pop_back();
        arr.assign(N+1, vector<T>(M+1,0));
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                arr[i+1][j+1] = A[i][j];
            }
        }
        for (int i = 0; i <= N; i++) {
            for (int j = 0; j < M; j++) {
                arr[i][j+1] += arr[i][j];
            }
        }
        for (int j = 0; j <= M; j++) {
            for (int i = 0; i < N; i++) {
                arr[i+1][j] += arr[i][j];
            }
        }
    }

    //[h1,h2],[w1,w2]
    T get(int h1, int h2, int w1, int w2) {
        if (h1 > h2 || w1 > w2) return 0;
        return arr[h2+1][w2+1] - arr[h2+1][w1] - arr[h1][w2+1] + arr[h1][w1];
    }

    inline const vector<T> &operator[](int k) const {return arr[k+1];}
  	inline vector<T> &operator[](int k) {return arr[k+1];}
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////

void ABC005D() {
    int N; cin >> N;
    vector<vector<ll>> D(N, vector<ll>(N));
    for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) cin >> D[i][j];

    CumlativeSum2D<ll> C(D);
    vector<ll> A(N*N+1);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = i; k < N; k++) {
                for (int l = j; l < N; l++) {
                    int S = (k-i+1)*(l-j+1);
                    A[S] = max(A[S],C.get(i,k,j,l));
                }
            }
        }
    }
    for (int i = 1; i <= N*N; i++) A[i] = max(A[i],A[i-1]);
    int Q; cin >> Q;
    while (Q--) {
        int a; cin >> a;
        cout << A[a] << endl;
    }
}

void DSL_5_B() {
    int N; cin >> N;
    vector<vector<int>> A(1002, vector<int>(1002));
    for (int i = 0; i < N; i++) {
        int x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2;
        A[x1][y1]++;
        A[x1][y2]--;
        A[x2][y1]--;
        A[x2][y2]++;
    }
    CumlativeSum2D<int> C(A);
    int ans = 0;
    for (int i = 0; i <= 1000; i++) {
        for (int j = 0; j <= 1000; j++) {
            ans = max(ans,C[i][j]);
        }
    }

    cout << ans << endl;
}
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    //ABC005D();
    DSL_5_B();
}
