#include <bits/stdc++.h>
using namespace std;
int n, mx;
int a[2000];
map<int, vector<pair<int, int> > > mp;
vector<pair<int, int> > ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int r = 1; r <= n; r++) {
    int s = 0;
    for (int l = r; l >= 1; l--) {
      s += a[l];
      mp[s].push_back({l, r});
    }
  }
  for (auto vc : mp) {
    int j = 0, cnt = 0;
    for (auto p : vc.second) {
      if (p.first > j) {
        cnt++;
        j = p.second;
      }
    }
    if (mx < cnt) {
      mx = cnt;
      ans = vc.second;
    }
  }
  cout << mx << endl;
  int j = 0;
  for (auto p : ans) {
    if (p.first > j) {
      cout << p.first << ' ' << p.second << endl;
      j = p.second;
    }
  }
  return 0;
}
