#include <iostream>
using namespace std;

int main() {
    int n = 0;
    cin >> n;
    long long x[n];
    long long y[n];
    for (int i = 0; i < n; i++) {
        cin >> x[i]  >> y[i];
    }
    long long minx = 10000000;
    for (int i = 0; i < n; i++) {
        if (x[i] < minx) {
            minx = x[i];
        }
    }
    cout << endl << minx << endl;
    long long maxy = 0;
     for (int i = 0; i < n; i++) {
        if (y[i] > maxy) {
            maxy = y[i];
        }
    }
    cout << endl << maxy << endl;
    int cnt = 0;
    long long xi = 0;
    long long yi = 1;
    int i = 0;
    int maxcnt = 0;
    while (yi <= maxy) {
        while (i < n) {
            if (x[i] <= xi && y[i] >= yi) {
            cnt++;
                if (cnt > maxcnt) {
                    maxcnt = cnt;
                }
        }
            i++;
        }
        xi++; yi++;
    }
    cout << maxcnt;
    return 0;
}
