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