#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 200;
long long a[N], n, sum, ans, res, kol, cost, r;
vector<pair<long long, pair<long long, long long> > > v;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    sum = 0;
    for (int j = i; j <= n; j++) {
      sum += a[j];
      v.push_back({sum, {j, i}});
    }
  }
  sort(v.begin(), v.end());
  cost = v[0].first;
  kol = 0;
  r = 0;
  for (auto x : v) {
    if (x.first == cost) {
      if (x.second.second > r) {
        r = x.second.first;
        kol++;
        if (kol > ans) {
          ans = kol;
          res = cost;
        }
      }
    } else {
      cost = x.first;
      kol = 1;
      r = x.second.first;
    }
  }
  cout << ans << "\n";
  r = 0;
  for (auto x : v)
    if (x.first == res) {
      if (x.second.second > r) {
        r = x.second.first;
        cout << x.second.second << " " << x.second.first << "\n";
      }
    }
  return 0;
}
