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

public class matches_af_slow implements Runnable {
	public static void main(String[] args) {
		new Thread(new matches_af_slow()).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");
		for (int i = n; i >= 1; --i) {
			if (sum % i != 0) continue;
			int ts = (int)(sum / i);
			HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();
			int tsum = 0;
			for (int j = 0; j < n; ++j) {
				tsum = (tsum + a[j]) % ts;
				hm.put(tsum, (hm.containsKey(tsum) ? hm.get(tsum) : 0) + 1);
			}
			for (Map.Entry<Integer, Integer> en : hm.entrySet()) {
				if (en.getValue() == 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 != en.getKey()) {
							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;
				}
			}
		}
		
	}
}
