#include <bits/stdc++.h>
using namespace std;
long long n, sum, maxcnt, maxsum, a[2000], lst = -10;
int main() {
  map<long long, long long> start;
  map<long long, long long> last;
  map<long long, long long> cnt;
  vector<pair<long long, long long> > v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  maxcnt = -1;
  for (int i = 0; i < n; i++) {
    sum = 0;
    for (int j = i; j < n; j++) {
      sum += a[j];
      if (last[sum] == 0 || last[sum] < i) {
        last[sum] = j;
        cnt[sum]++;
        if (cnt[sum] > maxcnt) {
          maxcnt = cnt[sum];
          maxsum = sum;
        }
      }
      if (last[sum] > j) {
        last[sum] = j;
      }
    }
  }
  cout << maxcnt << endl;
  for (int i = 0; i < n; i++) {
    sum = 0;
    for (int j = i; j < n; j++) {
      sum += a[j];
      if (sum == maxsum && j < lst) {
        lst = j;
        v.pop_back();
        v.push_back(make_pair(i + 1, j + 1));
        break;
      }
      if (i <= lst) {
        continue;
      }
      if (sum == maxsum) {
        lst = j;
        v.push_back(make_pair(i + 1, j + 1));
        break;
      }
    }
  }
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].first << " " << v[i].second << endl;
  }
  return 0;
}
