#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("-Ofast", "-funroll-all-loops", "-ffast-math")
#pragma GCC target("avx2,fma")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long long Linf = 0x7f7f7f7f7f7f7f7f;
const int Inf = 0x3f3f3f3f;
const int MAXN = 2000;
int n, a[MAXN], sum[MAXN];
map<int, vector<pair<int, int>>> mp;
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], sum[i] = sum[i - 1] + a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      int sm = sum[j] - sum[i - 1];
      mp[sm].push_back(make_pair(i, j));
    }
  }
  int mx = 0;
  vector<pair<int, int>> ansVec;
  for (auto piv : mp) {
    vector<pair<int, int>> vec = piv.second, tp;
    sort(vec.begin(), vec.end(), [](pair<int, int> a, pair<int, int> b) {
      return a.second < b.second;
    });
    int r = -1;
    for (auto pi : vec) {
      if (pi.first <= r) continue;
      r = pi.second;
      tp.push_back(pi);
    }
    if (int(tp.size()) > mx) ansVec = tp, mx = tp.size();
  }
  cout << ansVec.size() << '\n';
  for (auto pi : ansVec) cout << pi.first << ' ' << pi.second << '\n';
  return 0;
}
