#include <bits/stdc++.h>
using namespace std;
const int N = 1505;
int a[N], t, Q[N];
vector<pair<int, int> > P[N * N];
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    Q[i] = Q[i - 1] + a[i];
  }
  vector<int> v;
  map<int, int> mp;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      v.push_back(Q[j] - Q[i - 1]);
    }
  }
  sort(v.begin(), v.end());
  for (int x : v)
    if (!mp[x]) mp[x] = ++t;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      P[mp[Q[j] - Q[i - 1]]].push_back({j, i});
    }
  }
  int idx = 1, mx = 0;
  for (int i = 1; i <= t; i++) {
    int cnt = 0, prv = 0;
    sort(P[i].begin(), P[i].end());
    for (auto x : P[i]) {
      if (prv < x.second) {
        ++cnt;
        prv = x.first;
      }
    }
    if (cnt > mx) {
      mx = cnt;
      idx = i;
    }
  }
  int prv = 0;
  cout << mx << endl;
  for (auto x : P[idx]) {
    if (prv < x.second) {
      prv = x.first;
      cout << x.second << " " << x.first << endl;
    }
  }
}
