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

public class matches_af implements Runnable {
	public static void main(String[] args) {
		new Thread(new matches_af()).start();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;

	public void run() {
		try {
			br = new BufferedReader(new FileReader("matches.in"));
			out = new PrintWriter("matches.out");
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(-1);
		}
	}

	String nextToken() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new Error("Enexpected end of file");
			}
		}
		return st.nextToken();
	}

	void myAssert(boolean e, String msg) {
		if (!e) {
			throw new Error(msg);
		}
	}

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

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

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

	
	final int MAX_SUM = (int)1e+9;
	final int MAX_N = 20000;
	
	Random rand = new Random();
	
	void solve() throws IOException {
		int n = nextInt();
		myAssert(3 <= n && n <= MAX_N, "n out of bounds exception");
		int[] a = new int[n];
		long sum = 0;
		for (int i = 0; i < n; ++i) {
			a[i] = nextInt();
			myAssert(1 <= a[i] && a[i] <= MAX_SUM, "a[" + i + "] out of bounds exception");
			sum = sum + a[i];
		}
		myAssert(1 <= sum && sum <= MAX_SUM, "sum out of bounds exception");
		int[] al = new int[n];
		for (int i = n; i >= 1; --i) {
			if (sum % i != 0) continue;
			int ts = (int)(sum / i);
			int tsum = 0;
			for (int j = 0; j < n; ++j) {
				tsum = (tsum + a[j]) % ts;
				al[j] = tsum;
			}
			Arrays.sort(al);
			int f = 0;
			for (int k = 1; k <= n; ++k) {
				if (k == n || al[k - 1] != al[k]) {
					if (k - f == i) {
						out.println(n - i);
						tsum = 0;
						int cnt = n;
						int p = 1;
						int fnum = -2;
						for (int j = 0; j < n; ++j) {
							tsum = (tsum + a[j]) % ts;
							if (tsum != al[f]) {
								if (j + 1 < n) {
									out.println(p + " " + (j + 2));
								} else {
									out.println(p + " " + fnum);
								}
								p = ++cnt;
							} else {
								if (fnum < 0) fnum = p;
								p = j + 2;
							}
						}
						return;
					}
					f = k;
				}
			}
		}
		
	}	
}
