#include <bits/stdc++.h>
using namespace std;
int n;
int a[1505];
map<int, set<pair<int, int> > > m;
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];
  for (int i = 1; i <= n; i++) {
    int csum = 0;
    for (int j = i; j <= n; j++) {
      csum += a[j];
      m[csum].insert(make_pair(j, i));
    }
  }
  vector<pair<int, int> > ans;
  for (auto i : m) {
    int r = -1;
    vector<pair<int, int> > temp;
    for (auto j : i.second) {
      if (j.second > r) {
        temp.push_back(make_pair(j.second, j.first));
        r = j.first;
      }
    }
    if (temp.size() > ans.size()) ans = temp;
  }
  cout << ans.size() << endl;
  for (auto i : ans) cout << i.first << " " << i.second << endl;
  return 0;
}
