#include <bits/stdc++.h>
using namespace std;
int n;
long long a[1505];
map<long long, vector<pair<int, int> > > m;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  a[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  for (int i = 1; i <= n; i++) {
    set<long long> s;
    for (int j = i; j <= n; j++) {
      int x = a[j] - a[i - 1];
      if (!s.count(x)) {
        m[x].push_back(make_pair(j, i));
        s.insert(x);
      }
    }
  }
  vector<pair<int, int> > ans;
  for (auto it : m) {
    vector<pair<int, int> > tp = it.second;
    sort(tp.begin(), tp.end());
    vector<pair<int, int> > res;
    int tmp = -1;
    for (auto t : tp) {
      if (t.second > tmp) {
        res.push_back(t);
        tmp = t.first;
      }
    }
    if (res.size() > ans.size()) ans = res;
  }
  cout << ans.size() << endl;
  for (auto i : ans) cout << i.second << " " << i.first << endl;
  return 0;
}
