#include <bits/stdc++.h>
using namespace std;
int n, a[55], k, an;
bool vis[55];
vector<pair<int, int> > seg[10000], ans;
vector<int> v;
map<int, int> m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    for (int j = i; j <= n; j++) {
      sum += a[j];
      if (m[sum] == 0) {
        m[sum] = ++k;
        v.push_back(k);
      }
      seg[m[sum]].push_back({i, j});
    }
  }
  for (int i = 0; i < v.size(); i++) {
    int x = v[i], ann = 0;
    vector<pair<int, int> > sg = seg[x], vv;
    while (sg.size()) {
      int mn = 1e9, l, r, ind, f = 0;
      for (int j = 0; j < sg.size(); j++) {
        bool t = false;
        int q = sg[j].first, w = sg[j].second;
        for (int z = q; z <= w; z++) {
          if (vis[z]) {
            t = true;
            break;
          }
        }
        if (t == true) {
          ind = j;
          f = 1;
          break;
        }
        if (mn > w - q + 1) {
          mn = (w - q) + 1;
          l = q;
          r = w;
          ind = j;
        }
      }
      if (f == 0) {
        for (int j = l; j <= r; j++) vis[j] = 1;
        ann++;
        vv.push_back({l, r});
      }
      sg.erase(sg.begin() + ind);
    }
    if (ann > an) {
      an = ann;
      ans = vv;
    }
    memset(vis, 0, sizeof vis);
  }
  cout << an << endl;
  for (int i = 0; i < an; i++)
    cout << ans[i].first << ' ' << ans[i].second << endl;
}
