n = int(input()) ys = list(map(int, input().split(" "))) left = [None for _ in range(n)] right = [None for _ in range(n)] for index in range(1, n): if ys[index] > ys[index-1]: left[index] = 1 continue if ys[index] == ys[index-1]: if left[index-1] is not None: left[index] = left[index-1] + 1 for index in range(n-2, -1, -1): if ys[index] > ys[index+1]: right[index] = 1 continue if ys[index] == ys[index+1]: if right[index+1] is not None: right[index] = right[index+1] + 1 min_value, best_index = float("inf"), None for index in range(1, n-1): if left[index] is None or right[index] is None: continue if left[index] + right[index] < min_value: min_value = left[index] + right[index] best_index = index if best_index is None: print(0) else: print(best_index, best_index + min_value) # print(left) # print(right)