#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::map;
using std::pair;
using std::vector;
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i != n; ++i) {
    cin >> arr[i];
  }
  map<int, vector<pair<int, int>>> blocks;
  for (int i = 0; i != n; ++i) {
    int cnt = 0;
    for (int j = i; j != n; ++j) {
      cnt += arr[j];
      blocks[cnt].push_back({i, j});
    }
  }
  int Max = 0, cur = 0;
  for (auto &i : blocks) {
    int End = -1, t = 0;
    vector<pair<int, int>> &tmp = i.second;
    sort(tmp.begin(), tmp.end(),
         [](pair<int, int> lval, pair<int, int> rval) -> bool {
           return lval.second < rval.second;
         });
    for (int j = 0; j < tmp.size(); ++j) {
      if (End < tmp[j].first) {
        t++;
        End = tmp[j].second;
      } else {
        tmp[j].first = -1;
      }
    }
    if (Max < t) {
      Max = t;
      cur = i.first;
    }
  }
  cout << Max << '\n';
  for (auto i : blocks[cur]) {
    if (i.first == -1) continue;
    cout << i.first + 1 << " " << i.second + 1 << '\n';
  }
  return 0;
}
