#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f;
using namespace std;
struct node {
  int l, r, num;
  node(int l = 0, int r = 0, int num = 0) : l(l), r(r), num(num) {}
};
int n, a[55], sum[55][55];
vector<node> v;
vector<node> ans[55];
node temp[55], dp[55];
bool cmp(const node& a, const node& b) {
  if (a.num == b.num) {
    return a.r < b.r;
  } else
    return a.num < b.num;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    for (int j = 1; j <= i; j++) sum[j][i] = sum[j][i - 1] + a[i];
  }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) v.push_back(node(i, j, sum[i][j]));
  sort(v.begin(), v.end(), cmp);
  int num = inf, maxk = 1;
  for (int i = 0, k = 0, r = 0; i <= v.size(); i++) {
    if (num == inf || num != v[i].num || i == v.size()) {
      if (num != inf && ans[k].empty()) {
        for (int j = 0; j < n; j++) ans[k].push_back(temp[j]);
        maxk = max(maxk, k);
      }
      temp[0].l = v[i].l;
      temp[0].r = v[i].r;
      temp[0].num = v[i].num;
      num = v[i].num;
      k = 1;
      r = v[i].r;
    } else {
      if (v[i].l <= r)
        continue;
      else {
        temp[k].l = v[i].l;
        temp[k].r = v[i].r;
        temp[k].num = v[i].num;
        k++;
        r = v[i].r;
      }
    }
  }
  cout << maxk << endl;
  for (int i = 0; i < min((size_t)maxk, ans[maxk].size()); i++)
    cout << ans[maxk][i].l << " " << ans[maxk][i].r << endl;
  return 0;
}
