#include <bits/stdc++.h>
using namespace std;
map<long long, vector<pair<int, int> > > mp;
vector<pair<int, int> >::iterator it;
const int N = 1550;
int n, a[N], k;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    long long sum = 0;
    for (int j = i; j >= 1; j--) {
      sum += a[j];
      if (mp[sum].size() == 0 || mp[sum].back().second < j) {
        mp[sum].push_back({j, i});
      }
      if (i == 1) k = sum;
      if (mp[sum].size() > mp[k].size()) k = sum;
    }
  }
  printf("%d\n", mp[k].size());
  for (it = mp[k].begin(); it != mp[k].end(); it++) {
    printf("%d %d\n", it->first, it->second);
  }
  return 0;
}
