#include <bits/stdc++.h>
using namespace std;
map<long long int, vector<pair<long long int, long long int> > > mapp;
bool cmp(pair<long long int, long long int> &p1,
         pair<long long int, long long int> &p2) {
  if (p1.second != p2.second) return p1.second < p2.second;
  return p1.first < p2.first;
}
int main() {
  long long int n, i, j, k;
  cin >> n;
  vector<long long int> a(n);
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    long long int s = 0;
    for (j = i; j < n; j++) s += a[j], mapp[s].push_back({i, j});
  }
  long long int ans = 0, f = 0;
  for (auto j : mapp) {
    sort(mapp[j.first].begin(), mapp[j.first].end(), cmp);
    long long int bound = -1, cnt = 0;
    for (auto k : mapp[j.first]) {
      if (k.first > bound) cnt++, bound = k.second;
    }
    if (ans < cnt) ans = cnt, f = j.first;
  }
  cout << ans << '\n';
  long long int bound = -1, cnt = 0;
  for (auto j : mapp[f]) {
    if (j.first > bound)
      cout << j.first + 1 << " " << j.second + 1 << '\n', bound = j.second;
  }
}
