#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  map<int, vector<pair<int, int>>> mp;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i; j++) {
      mp[a[i] - a[j - 1]].push_back(make_pair(j, i));
    }
  }
  vector<pair<int, int>> ans;
  for (map<int, vector<pair<int, int>>>::iterator it = mp.begin();
       it != mp.end(); it++) {
    vector<pair<int, int>>& b = it->second;
    sort(b.begin(), b.end(),
         [](const pair<int, int>& lhs, const pair<int, int>& rhs) {
           if (lhs.second != rhs.second) return lhs.second < rhs.second;
           return lhs.first < rhs.first;
         });
    int r = -1;
    vector<pair<int, int>> c;
    for (int i = 0; i < b.size(); i++) {
      if (r < b[i].first) {
        r = b[i].second;
        c.push_back(b[i]);
      }
    }
    if (ans.size() < c.size()) ans = c;
  }
  cout << ans.size() << "\n";
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first << " " << ans[i].second << "\n";
  return 0;
}
