#include <bits/stdc++.h>
using namespace std;
map<int, vector<pair<int, int>>> block;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; ++i) {
    int sum = 0;
    for (int j = i; j >= 0; --j) {
      sum += arr[j];
      block[sum].push_back({j, i});
    }
  }
  int h = 0;
  int index = 0;
  for (auto p = block.begin(); p != block.end(); ++p) {
    int c = 0;
    int r = -1;
    for (auto l = p->second.begin(); l != p->second.end(); ++l) {
      if (l->first > r) {
        ++c;
        r = l->second;
      }
    }
    if (c > h) {
      h = c;
      index = p->first;
    }
  }
  cout << h << '\n';
  int r = -1;
  for (auto p = block[index].begin(); p != block[index].end(); ++p) {
    if (p->first > r) {
      cout << p->first + 1 << ' ' << p->second + 1 << '\n';
      r = p->second;
    }
  }
  return 0;
}
