#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  map<int, vector<pair<int, int>>> mp;
  for (int i = 0; i < n; i++) {
    int s = 0;
    for (int j = i; j < n; j++) {
      s += v[j];
      if (mp.find(s) == mp.end()) mp[s] = vector<pair<int, int>>();
      mp[s].push_back({j + 1, i + 1});
    }
  }
  vector<pair<int, int>> ans;
  for (auto p : mp) {
    vector<pair<int, int>> tmp = p.second;
    sort(tmp.begin(), tmp.end());
    vector<pair<int, int>> tans;
    int lim = 0;
    for (pair<int, int> p : tmp)
      if (p.second > lim) tans.push_back(p), lim = p.first;
    if (tans.size() > ans.size()) ans = tans;
  }
  cout << ans.size() << endl;
  for (pair<int, int> p : ans) cout << p.second << " " << p.first << endl;
  return 0;
}
