using namespace std;
int N;
cin >> N;
vector<int> apex(N);
struct route {
int start{ -1 };
int end{ -1 };
};
vector<route> arrayRoute(static_cast<int>(N / 3) + 1);
int routeIndex{ 0 };
for (int i{ 0 }; i < N; ++i)
cin >> apex[i];
bool isRouteFound{ false };
for (int i{ 1 }; i < N - 1; ++i)
{
if (apex[i - 1] < apex[i])
{
int relIndex = i;
while (apex[relIndex] == apex[relIndex + 1])
++relIndex;
if (apex[relIndex] > apex[relIndex + 1])
{
arrayRoute[routeIndex].start = i;
arrayRoute[routeIndex].end = relIndex + 2;
++routeIndex;
isRouteFound = true;
}
}
}
if (!isRouteFound)
cout << 0;
else
{
int minRouteIndex{ 0 }, i{ 0 };
while (arrayRoute[i + 1].start != -1)
{
if (arrayRoute[i + 1].end - arrayRoute[i + 1].start < arrayRoute[i].end - arrayRoute[i].start)
minRouteIndex = i + 1;
++i;
}
cout << '\n' << arrayRoute[minRouteIndex].start << '\n' << arrayRoute[minRouteIndex].end;
}