#include <bits/stdc++.h>
using namespace std;
signed main() {
  map<long long, vector<pair<long long, long long>>> mapp;
  long long n, a[2000];
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 1; i < n; i++) a[i] += a[i - 1];
  for (long long i = 0; i < n; i++)
    for (long long j = i; j < n; j++) {
      if (i)
        mapp[a[j] - a[i - 1]].push_back(make_pair(j, i));
      else
        mapp[a[j]].push_back(make_pair(j, i));
    }
  long long maxx = 0, maxi = 0;
  for (auto &v : mapp) {
    auto &vec = v.second;
    sort(vec.begin(), vec.end());
    long long r = -1, cnt = 0;
    for (auto i : vec)
      if (i.second > r) {
        r = i.first, cnt++;
      }
    if (cnt > maxx) {
      maxx = cnt;
      maxi = v.first;
    }
  }
  cout << maxx << endl;
  long long r = -1;
  auto vec = mapp[maxi];
  for (auto i : vec) {
    if (i.second > r) {
      r = i.first;
      cout << i.second + 1 << ' ' << i.first + 1 << endl;
    }
  }
}
