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

public class matches_aa_slow implements Runnable {

	public static void main(String[] args) {
		new Thread(new matches_aa_slow()).start();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	boolean eof = false;
	Random rand = new Random(this.hashCode());

	@Override
	public void run() {
		Locale.setDefault(Locale.US);
		try {
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(566);
		}
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	BigInteger nextBigInteger() {
		return new BigInteger(nextToken());
	}

	void myAssert(boolean u, String message) {
		if (!u) {
			throw new Error("Assertion failed!!! " + message);
		}
	}

	long inBounds(long x, long l, long r, String name) {
		myAssert(l <= x && x <= r, name + " is not in bounds!!! " + x
				+ " not in [" + l + ".." + r + "]");
		return x;
	}

	int inBounds(int x, int l, int r, String name) {
		myAssert(l <= x && x <= r, name + " is not in bounds!!! " + x
				+ " not in [" + l + ".." + r + "]");
		return x;
	}

	String FNAME = "matches_aa_slow".substring(0, "matches_aa_slow"
			.indexOf('_'));

	private void solve() throws IOException {
		int n = nextInt();
		long[] a = new long[n];
		long sum = 0;
		for (int i = 0; i < a.length; i++) {
			a[i] = nextLong();
			sum += a[i];
		}
		int ans = Integer.MAX_VALUE / 2;
		int ansi = 0;
		for (int i = 0; i < a.length; i++) {
			long cur = 0;
			for (int j = 0; j < a.length; j++) {
				cur += a[(i + j) % a.length];
				if (sum % cur == 0 && a.length - sum / cur < ans) {
					int aa = check(a, i, cur);
					if (ans > aa) {
						ans = aa;
						ansi = i;
					}
				}
				if (a.length - sum / cur >= ans) {
					break;
				}
			}
		}
		out.println(ans);
		n++;
		long cur = 0;
		long size = sum / (a.length - ans);
		boolean start = false;
		for (int i = 0; i < a.length; i++) {
			if (cur > 0) {
				if (!start) {
					out.println(n++ + " " + ((ansi + i) % a.length + 1));
				} else {
					out.println(((ansi + i + a.length - 1) % a.length + 1)
							+ " " + ((ansi + i) % a.length + 1));
				}
				start = false;
			} else {
				start = true;
			}
			cur += a[(i + ansi) % a.length];
			if (cur == size) {
				cur = 0;
				if (!start) {
					n++;
				}
			}
		}
	}

	private int check(long[] a, int i, long size) {
		int k = 0;
		long cur = 0;
		for (int j = 0; j < a.length; j++) {
			cur += a[(i + j) % a.length];
			if (cur == size) {
				k++;
				cur = 0;
			}
			if (cur > size) {
				return Integer.MAX_VALUE / 2;
			}
		}
		if (cur > 0) {
			return Integer.MAX_VALUE / 2;
		}
		return a.length - k;
	}

}
