#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<long long, long long>& a,
               const pair<long long, long long>& b) {
  return (a.second < b.second);
}
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  map<long long, vector<pair<long long, long long> > > m;
  for (long long i = 0; i < n; i++) {
    long long sum = 0;
    for (long long j = i; j < n; j++) {
      sum += a[j];
      m[sum].push_back({i + 1, j + 1});
    }
  }
  long long ans = 0, tmp;
  for (auto it : m) {
    vector<pair<long long, long long> > v = it.second;
    sort(v.begin(), v.end(), sortbysec);
    long long c1 = 1, r = v[0].second;
    for (long long i = 1; i < v.size(); i++) {
      if (v[i].first > r) {
        c1++;
        r = v[i].second;
      }
    }
    if (c1 > ans) {
      ans = c1;
      tmp = it.first;
    }
  }
  cout << ans << endl;
  vector<pair<long long, long long> > v = m[tmp];
  sort(v.begin(), v.end(), sortbysec);
  long long r = v[0].second;
  cout << v[0].first << " " << v[0].second << endl;
  for (long long i = 1; i < v.size(); i++) {
    if (v[i].first > r) {
      cout << v[i].first << " " << v[i].second << endl;
      r = v[i].second;
    }
  }
  return 0;
}
