#include <bits/stdc++.h>
using namespace std;
const int N = 1500 + 10;
map<int, vector<pair<int, int> > > cnt;
int n, a[N];
vector<pair<int, int> > ans;
vector<pair<int, int> > tmp;
int main() {
  ios::sync_with_stdio(false);
  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 t = 0;
    for (int j = i; j >= 1; j--) {
      t += a[j];
      cnt[t].push_back({j, i});
    }
  }
  for (auto u : cnt) {
    tmp.clear();
    int now = -1;
    for (auto t : u.second) {
      if (t.first > now) {
        tmp.push_back(t);
        now = t.second;
      }
    }
    if (tmp.size() > ans.size()) ans = tmp;
  }
  cout << ans.size() << endl;
  for (auto u : ans) cout << u.first << ' ' << u.second << endl;
  return 0;
}
