#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  map<long long, vector<pair<long long, long long> > > mp;
  for (long long i = 0; i < n; i++) {
    long long sum = 0;
    for (long long j = i; j >= 0; j--) {
      sum += arr[j];
      mp[sum].push_back({j, i});
    }
  }
  vector<pair<long long, long long> > ans;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    long long val = 0, r = -1;
    vector<pair<long long, long long> > tmp;
    for (long long i = 0; i < it->second.size(); i++) {
      if (it->second[i].first > r) {
        tmp.push_back({it->second[i]});
        r = it->second[i].second;
      }
    }
    if (tmp.size() > ans.size()) ans = tmp;
  }
  cout << ans.size() << endl;
  for (long long i = 0; i < ans.size(); i++) {
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;
  }
  return 0;
}
