#include <bits/stdc++.h>
using namespace std;
long long int summ[1600];
int n;
int a[1600];
void init() {
  for (int i = 1; i <= n; ++i) summ[i] = summ[i - 1] + a[i];
}
bool sortby(pair<int, int> &x, pair<int, int> &y) {
  return x.second < y.second;
}
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];
  init();
  map<int, vector<pair<int, int> > > mapp;
  for (int i = 1; i <= n; ++i) {
    for (int j = i; j <= n; j++) {
      int tmp = summ[j] - summ[i - 1];
      mapp[tmp].push_back({i, j});
    }
  }
  vector<pair<int, int> > ans;
  for (auto ptr = mapp.begin(); ptr != mapp.end(); ptr++) {
    vector<pair<int, int> > temp;
    temp = ptr->second;
    sort(temp.begin(), temp.end(), sortby);
    vector<pair<int, int> > rtemp;
    int lst = 0;
    for (int i = 0; i < temp.size(); ++i) {
      if (temp[i].first > lst) {
        lst = temp[i].second;
        rtemp.push_back(temp[i]);
      }
    }
    if (ans.size() < rtemp.size()) ans = rtemp;
  }
  cout << ans.size() << endl;
  for (pair<int, int> x : ans) {
    cout << x.first << " " << x.second << endl;
  }
  return 0;
}
