#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f;
const int maxn = 1e3 + 505;
int sum[maxn], n;
struct node {
  int l, r;
};
bool cmp(node x, node y) { return x.r < y.r; }
map<int, vector<node> > num;
int main() {
  std::ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> sum[i], sum[i] += sum[i - 1];
  for (int i = 1; i <= n; ++i)
    for (int j = i; j <= n; ++j) num[sum[j] - sum[i - 1]].push_back(node{i, j});
  int cnt = 0;
  vector<node> ans;
  for (auto it = num.begin(); it != num.end(); ++it) {
    vector<node> &tp = it->second;
    sort(tp.begin(), tp.end(), cmp);
    vector<node> tt;
    int nr = -1, count = 0;
    for (int i = 0; i <= int((tp).size()) - 1; ++i) {
      if (tp[i].l > nr)
        count++, nr = tp[i].r, tt.push_back(node{tp[i].l, tp[i].r});
    }
    if (count > cnt) ans = tt, cnt = count;
  }
  cout << int((ans).size()) << endl;
  for (int i = 0; i <= int((ans).size()) - 1; ++i)
    cout << ans[i].l << " " << ans[i].r << endl;
  return 0;
}
