#include <bits/stdc++.h>
using namespace std;
struct DynItem {
  int l, r;
  int col;
};
int n;
int ar[2000], intar[2000];
std::vector<map<int, DynItem>> s2i;
int main() {
  cin >> n;
  intar[0] = 0;
  for (int i = 0; i < (n); ++i) {
    cin >> ar[i];
    intar[i + 1] = intar[i] + ar[i];
  }
  s2i.push_back(std::map<int, DynItem>());
  for (int i = 0; i < (n); ++i) {
    s2i.push_back(s2i[i]);
    for (int j = 0; j < (i + 1); ++j) {
      int s = intar[i + 1] - intar[j];
      DynItem d;
      d.l = j;
      d.r = i;
      if (s2i[j].find(s) == s2i[j].end()) {
        d.col = 1;
      } else {
        d.col = s2i[j][s].col + 1;
      }
      if (s2i[i + 1].find(s) == s2i[i + 1].end() || s2i[i + 1][s].col < d.col) {
        s2i[i + 1][s] = d;
      }
    }
  }
  int maxcol = 0;
  int maxs = 0;
  for (auto p : s2i[n]) {
    if (p.second.col > maxcol) {
      maxcol = p.second.col;
      maxs = p.first;
    }
  }
  cout << maxcol << endl;
  int curidx = n;
  for (int i = 0; i < (maxcol); ++i) {
    DynItem d = s2i[n][maxs];
    cout << d.l + 1 << " " << d.r + 1 << endl;
    n = d.l;
  }
}
