import java.io.*;
import java.util.*;

public class agro_md {
	static final int M = 3;

	public void run() {
		int n = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
		}
		int start = 0;
		int same = 1;
		int best = 1;
		int bestStart = 0;
		for (int i = 1; i < n; i++) {
			if (a[i] == a[i - 1]) {
				same++;
			} else {
				same = 1;
			}
			if (same >= M) {
				if (same == M) {
					if (i - start > best) {
						best = i - start;
						bestStart = start;
					}
				}
				start = i - M + 2;
			}
		}
		if (n - start > best) {
			best = n - start;
			bestStart = start;
		}
		out.println((bestStart + 1) + " " + (bestStart + best));
	}

	static Scanner in;
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		String fileName = agro_md.class.getSimpleName().replaceFirst("_.*", "").toLowerCase();
		String inputFileName = fileName + ".in";
		String outputFileName = fileName + ".out";

		Locale.setDefault(Locale.US);
		in = new Scanner(new File(inputFileName));
		out = new PrintWriter(outputFileName);
		new agro_md().run();
		in.close();
		out.close();
	}
}
