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

template<typename X, typename Y>
bool chmax(X& a, Y b) { return (a < b) ? a = b, 1 : 0; }

template<typename X, typename Y>
bool chmin(X& a, Y b) { return (a > b) ? a = b, 1 : 0; }

using ll = long long;
using ull = unsigned long long;

const int N = 1e5+5;
const ull BASE = 1e6+3;

int n, a[N];
ull P[N], H[N];
int freq[N];

ull get_hash(int l, int r) {
    return H[r] - H[l - 1] * P[r - l + 1];
}

struct Info {
    ull h;
    int p;
    bool operator<(const Info& o) const {
        if (h != o.h) return h < o.h;
        return p < o.p;
    }
};

int check(int L, int f) {
    if (L > n) return -1;
    vector<Info> S;
    for (int i = L; i <= n; i++) S.push_back({get_hash(i - L + 1, i), i});
    sort(S.begin(), S.end());
    int pos = -1, cnt = 1;
    for (size_t i = 1; i <= (int)S.size(); i++) {
        if (i < (int)S.size() && S[i].h == S[i - 1].h) cnt++;
        else {
            if (cnt == f) chmax(pos, S[i - 1].p);
            cnt = 1;
        }
    }
    return pos;
}

void solve() {
    cin >> n;
    vector<int> vals;
    for (int i = 1; i <= n; i++) { 
        cin >> a[i];
        vals.push_back(a[i]);
    }
    sort(vals.begin(), vals.end());
    vals.erase(unique(vals.begin(), vals.end()), vals.end());
    int mx_freq = 0;
    for (int i = 1; i <= n; i++) {
        a[i] = lower_bound(vals.begin(), vals.end(), a[i]) - vals.begin() + 1;
        freq[a[i]]++;
        chmax(mx_freq, freq[a[i]]);
    }
    P[0] = 1;
    for (int i = 1; i <= n; i++) {
        P[i] = P[i - 1] * BASE;
        H[i] = H[i - 1] * BASE + a[i];
    }
    int low = 1, high = n, best_len = 1, best_pos = n;
    while (low <= high) {
        int mid = low + (high - low) / 2;
        int p = check(mid, mx_freq);
        if (p != -1) {
            best_len = mid;
            best_pos = p;
            low = mid + 1;
        } else high = mid - 1;
    }
    cout << best_pos - best_len + 1 << ' ' << best_pos << '\n';
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    #define TASK "BAI4"
    if (fopen(TASK".INP", "r")) {
        freopen(TASK".INP", "r", stdin);
        freopen(TASK".OUT", "w", stdout);
    }

    int tests = 1; // cin >> tests;
    while (tests--) solve();

    #ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0;
}