#include <bits/stdc++.h>
using namespace std;
const int maxn = 2010;
int n, v[maxn], topt, sum[maxn], cnt, ll[maxn], rr[maxn], nl[maxn], nr[maxn];
struct da {
  int l, r, ss;
} a[maxn * maxn];
bool cmp(da aa, da bb) {
  if (aa.ss == bb.ss) return aa.r < bb.r;
  if (aa.ss == bb.ss) return aa.l < bb.l;
  return aa.ss < bb.ss;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &v[i]), sum[i] = sum[i - 1] + v[i];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++) a[++topt] = {j, i, sum[i] - sum[j - 1]};
  sort(a + 1, a + topt + 1, cmp);
  for (int i = 1; i <= topt; i++) {
    int num = 1, la = a[i].r, j = i;
    nl[num] = a[i].l;
    nr[num] = a[i].r;
    while (j + 1 <= topt && a[j + 1].ss == a[i].ss) {
      j++;
      if (a[j].l > la) {
        num++;
        nl[num] = a[j].l;
        nr[num] = a[j].r;
        la = a[j].r;
      }
    }
    if (num > cnt) {
      cnt = num;
      for (int k = 1; k <= cnt; k++) ll[k] = nl[k], rr[k] = nr[k];
    }
    i = j;
  }
  printf("%d\n", cnt);
  for (int i = 1; i <= cnt; i++) printf("%d %d\n", ll[i], rr[i]);
  return 0;
}
