#include <bits/stdc++.h>
const int imax = INT32_MAX;
const int imin = INT32_MIN;
using namespace std;
const int mx = 10e5 + 10;
unordered_map<long long int, vector<vector<long long int>>> umap;
vector<long long int> nums;
bool check(long long int sum, vector<long long int> pair) {
  if (umap.find(sum) == umap.end()) {
    return true;
  }
  auto top = umap[sum].back();
  return (top[1] < pair[0]);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long int t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    nums.resize(n);
    for (long long int& in : nums) cin >> in;
    long long int curr = 0;
    for (long long int i = 1; i <= n; ++i) {
      curr += nums[i - 1];
      long long int sum = curr;
      for (long long int j = 1; j <= i; ++j) {
        vector<long long int> pair = {j, i};
        if (check(sum, pair)) {
          umap[sum].push_back(pair);
        }
        sum -= nums[j - 1];
      }
    }
    long long int win_sum = -1, win_size = 0;
    for (auto ele : umap) {
      if (ele.second.size() > win_size) {
        win_size = ele.second.size();
        win_sum = ele.first;
      }
    }
    cout << win_size << "\n";
    for (auto ele : umap[win_sum]) {
      cout << ele[0] << " " << ele[1] << "\n";
    }
  }
  return 0;
}
