#include <bits/stdc++.h>
using namespace std;
int dis(vector<pair<int, int>> &v) {
  int cont = 0, j = -1;
  for (auto &i : v) {
    if (i.first > j) {
      j = i.second;
      cont++;
    }
  }
  return cont;
}
int main() {
  ios_base::sync_with_stdio();
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = (0); i < (n); i++) cin >> a[i];
  map<int, vector<pair<int, int>>> m;
  for (int i = (0); i < (n); i++) {
    int sum = 0;
    for (int j = (i); j < (n); j++) {
      sum += a[j];
      m[sum].emplace_back(i, j);
    }
  }
  int cnt = -1, sol = 0;
  for (auto &it : m) {
    sort(it.second.begin(), it.second.end(),
         [](pair<int, int> &a, pair<int, int> &b) {
           return a.second < b.second;
         });
    int c = dis(it.second);
    if (cnt < c) {
      cnt = c;
      sol = it.first;
    }
  }
  cout << cnt << endl;
  int j = -1;
  for (auto &i : m[sol]) {
    if (i.first > j) {
      j = i.second;
      cout << i.first + 1 << " " << i.second + 1 << endl;
    }
  }
  return 0;
}
