#include <bits/stdc++.h>
using namespace std;
using namespace std;
bool compare(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }
void solve(int tim) {
  int n;
  scanf("%d", &n);
  vector<int> a(n + 1);
  for (int i{1}; i < n + 1; i++) scanf("%d", &a[i]);
  vector<int> cumm(n + 1, 0);
  for (int i{1}; i < n + 1; i++) cumm[i] = cumm[i - 1] + a[i];
  map<int, vector<pair<int, int> > > segs;
  for (int i{1}; i < n + 1; i++)
    for (int j{i}; j < n + 1; j++)
      segs[cumm[j] - cumm[i - 1]].push_back({i, j});
  for (map<int, vector<pair<int, int> > >::iterator mit = segs.begin();
       mit != segs.end(); mit++)
    sort(mit->second.begin(), mit->second.end(), compare);
  int maxm = INT_MIN;
  map<int, vector<pair<int, int> > >::iterator mnnit;
  for (map<int, vector<pair<int, int> > >::iterator mit = segs.begin();
       mit != segs.end(); mit++) {
    int lm = -1;
    int cnt = 0;
    for (auto x : mit->second)
      if (x.first > lm) {
        cnt++;
        lm = x.second;
      }
    if (cnt > maxm) {
      maxm = cnt;
      mnnit = mit;
    }
  }
  printf("%d\n", maxm);
  int lm = -1;
  for (auto x : mnnit->second)
    if (x.first > lm) {
      printf("%d %d\n", x.first, x.second);
      lm = x.second;
    }
}
int main() {
  int test = 1;
  for (int t{1}; t < test + 1; t++) {
    solve(t);
  }
}
