#include <bits/stdc++.h>
using namespace std;
const int N = 2200;
struct Data {
  int u, v, val;
  Data(int u = 0, int v = 0, int val = 0) : u(u), v(v), val(val) {}
};
bool operator<(Data lhs, Data rhs) {
  if (lhs.val != rhs.val) return lhs.val < rhs.val;
  if (lhs.u != rhs.u) return lhs.u < rhs.u;
  return lhs.v < rhs.v;
}
int s[N], a[N];
int dp[N];
vector<pair<int, int>> ans;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) s[i] = s[i - 1] + a[i];
  vector<Data> v;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) v.push_back(Data(i, j, s[j] - s[i - 1]));
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size();) {
    vector<pair<int, int>> cur;
    int j;
    for (j = i + 1; j < v.size() && v[j].val == v[i].val; j++)
      ;
    for (int k = j - 1; k >= i; k--) {
      if (cur.size() == 0 || cur.back().first > v[k].v)
        cur.emplace_back(v[k].u, v[k].v);
    }
    i = j;
    if (cur.size() > ans.size()) ans = cur;
  }
  cout << ans.size() << endl;
  for (auto it : ans) cout << it.first << " " << it.second << endl;
  return 0;
}
