#include <iostream>
using namespace std;
int main()
{
int n, a, b, i, secv=1, secmax=1, st=1, dr=1;
cin >> n;
cin >> a; i=1; st=1; dr=1;
while (i<n)
{
++i; cin >> b;
if (b==a) ++secv;
else
{
if (secv>=secmax) { secmax=secv; dr=i-1; st=i-secv; }
secv=1;
}
a=b;
}
if (secv>=secmax) { st=n+1-secv; dr=i; }
cout << st << " " << dr << endl;
return 0;
}