#include <bits/stdc++.h>
using namespace std;
signed main() {
  int n;
  cin >> n;
  int arr[n];
  set<int> sa;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  map<int, vector<pair<int, int> > > ma;
  for (int r = 0; r <= n - 1; r++) {
    int sum = 0;
    for (int l = r; l >= 0; l--) {
      sum += arr[l];
      sa.insert(sum);
      ma[sum].push_back(make_pair(l, r));
    }
  }
  vector<pair<int, int> > current;
  vector<pair<int, int> > ans;
  for (auto x : sa) {
    int ct = 0;
    int r = -1;
    for (auto y : ma[x]) {
      if (y.first > r) {
        current.push_back(y);
        r = y.second;
      }
    }
    if ((int)ans.size() < (int)current.size()) ans = current;
    current.clear();
  }
  cout << (int)ans.size() << endl;
  for (auto x : ans) {
    cout << x.first + 1 << " " << x.second + 1 << endl;
  }
  return 0;
}
