#include <bits/stdc++.h>
using namespace std;
map<int, vector<pair<int, int> > > mp;
map<int, int> ids;
int a[1510];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i] += a[i - 1];
    for (int j = 0; j < i; j++) {
      int x = a[i] - a[j];
      if (!ids.count(x)) {
        int y = ids.size();
        ids[x] = y;
      }
      x = ids[x];
      if (!mp.count(x)) {
        mp[x] = vector<pair<int, int> >();
      }
      mp[x].push_back(make_pair(i, j + 1));
    }
  }
  int ret = 0, pos = -1;
  for (int i = 0; i < ids.size(); i++) {
    int pre = -1;
    int ans = 0;
    vector<pair<int, int> > v = mp[i];
    sort(v.begin(), v.end());
    for (int i = 0; i < v.size(); i++) {
      if (v[i].second > pre) {
        ans++;
        pre = v[i].first;
      }
    }
    if (ans > ret) ret = ans, pos = i;
  }
  if (ret == 0) {
    printf("0\n");
    return 0;
  }
  cout << ret << endl;
  int pre = -1;
  int ans = 0;
  vector<pair<int, int> > v = mp[pos];
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    if (v[i].second > pre) {
      cout << v[i].second << " " << v[i].first << endl;
      pre = v[i].first;
    }
  }
  return 0;
}
