#include <bits/stdc++.h>
using namespace std;
long long p[2010];
long long sum(int l, int r) { return p[r] - (l ? p[l - 1] : 0); }
unordered_map<long long, vector<pair<int, int>>> res;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &p[i]);
    if (i) p[i] += p[i - 1];
  }
  int bestSize = 0;
  long long bestS;
  for (int r = 0; r < n; r++) {
    for (int l = 0; l <= r; l++) {
      long long s = sum(l, r);
      vector<pair<int, int>> &v = res[s];
      if (v.empty() || v.back().second < l) {
        v.push_back({l, r});
        if (v.size() > bestSize) {
          bestSize = v.size();
          bestS = s;
        }
      }
    }
  }
  vector<pair<int, int>> &v = res[bestS];
  printf("%d\n", v.size());
  for (int i = 0; i < v.size(); i++) {
    printf("%d %d\n", v[i].first + 1, v[i].second + 1);
  }
}
