#include <bits/stdc++.h>
using namespace std;
int n, v[1510], acum[1510];
map<int, vector<pair<int, int> > > m;
bool cmp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  vector<pair<int, int> > vans, vaux;
  cin >> n;
  for (int i = (0); i < (n); i++) {
    cin >> v[i];
    acum[i] = v[i];
    if (i > 0) acum[i] += acum[i - 1];
  }
  for (int i = (0); i < (n); i++) {
    int aux = v[i];
    m[aux].push_back(make_pair(i, i));
    for (int j = i - 1; j >= 0; j--) {
      aux += v[j];
      m[aux].push_back(make_pair(j, i));
    }
  }
  for (auto it = m.begin(); it != m.end(); it++) {
    sort(it->second.begin(), it->second.end(), cmp);
    vaux.clear();
    int last = -1;
    for (auto it2 = it->second.begin(); it2 != it->second.end(); it2++) {
      if (it2->first > last) {
        vaux.push_back(*it2);
        last = it2->second;
      }
    }
    if (vaux.size() > vans.size()) vans = vaux;
  }
  cout << vans.size() << '\n';
  for (auto it = vans.begin(); it != vans.end(); it++)
    cout << it->first + 1 << ' ' << it->second + 1 << '\n';
  return 0;
}
