#include <bits/stdc++.h>
using namespace std;
int cmp(pair<int, int> p1, pair<int, int> p2) { return p1.second < p2.second; }
int main() {
  int n;
  cin >> n;
  int *arr = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[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 += arr[j];
      m[sum].push_back(make_pair(i, j));
    }
  }
  vector<pair<int, int>> best;
  int num = 0;
  for (auto v : m) {
    int r = -1, cur = 0;
    vector<pair<int, int>> now;
    sort(v.second.begin(), v.second.end(), cmp);
    for (auto g : v.second) {
      if (g.first > r) {
        cur++;
        r = g.second;
        now.push_back(make_pair(g.first, g.second));
        if (cur > num) {
          num = cur;
          best = now;
        }
      }
    }
  }
  cout << num << endl;
  for (auto x : best) {
    cout << x.first + 1 << " " << x.second + 1 << endl;
  }
  return 0;
}
