#include <bits/stdc++.h>
using namespace std;
struct node {
  int l;
  int r;
};
int a[1505];
map<int, int> mp;
vector<node> v[2250000];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int b;
    scanf("%d", &b);
    a[i] += b + a[i - 1];
  }
  int tot = 0;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < i; j++) {
      if (mp[a[i] - a[j]] == 0) {
        tot++;
        mp[a[i] - a[j]] = tot;
      }
      int t = mp[a[i] - a[j]];
      if (v[t].size() == 0) {
        node c;
        c.l = j + 1;
        c.r = i;
        v[t].push_back(c);
      } else {
        if (v[t][v[t].size() - 1].r >= j + 1)
          continue;
        else {
          node c;
          c.l = j + 1;
          c.r = i;
          v[t].push_back(c);
        }
      }
      if (v[t].size() > v[ans].size()) {
        ans = t;
      }
    }
  }
  printf("%d\n", v[ans].size());
  for (int i = 0; i < v[ans].size(); i++) {
    printf("%d %d\n", v[ans][i].l, v[ans][i].r);
  }
}
