#include <bits/stdc++.h>
using namespace std;
int a[2000];
map<int, vector<pair<int, int>>> mp, o;
int main(void) {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &x), a[i] = a[i - 1] + x;
  for (int i = 1; i <= n; ++i)
    for (int j = i; j >= 1; --j) mp[a[i] - a[j - 1]].push_back(make_pair(j, i));
  int ans = 0, maxsize = 0;
  for (auto &v : mp) {
    for (int i = 0, j = -1; i < v.second.size(); ++i)
      if (j == -1 || v.second[i].first > v.second[j].second)
        o[v.first].push_back(v.second[i]), j = i;
    if (maxsize < o[v.first].size()) ans = v.first, maxsize = o[v.first].size();
  }
  printf("%d\n", maxsize);
  for (auto v : o[ans]) printf("%d %d\n", v.first, v.second);
  return 0;
}
