#include <bits/stdc++.h>
using namespace std;
const int N = 5e1 + 5;
int sum[N], a[N], dp[N], bdp[N], n;
map<int, int> used;
int intervalSum(int st, int en) { return sum[en] - sum[st - 1]; }
int calc(int st, int needed) {
  if (st > n) return 0;
  if (dp[st] > 0) return dp[st];
  int ans = 0;
  for (int en = st + 1; en <= n + 1; en++) {
    if (intervalSum(st, en - 1) == needed) {
      ans = max(ans, 1 + calc(en, needed));
      break;
    }
  }
  ans = max(ans, calc(st + 1, needed));
  dp[st] = ans;
  return dp[st];
}
vector<pair<int, int> > print(int needed, int st = 1) {
  if (st > n) return {};
  int c1 = 0, bend = 0;
  for (int en = st + 1; en <= n + 1; en++) {
    if (intervalSum(st, en - 1) == needed) {
      c1 = 1 + bdp[en];
      bend = en;
      break;
    }
  }
  int c2 = bdp[st + 1];
  if (c2 > c1) {
    return print(needed, st + 1);
  } else if (c1 == 0) {
    return {};
  }
  vector<pair<int, int> > ints = print(needed, bend);
  ints.push_back({st, bend - 1});
  return ints;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum[i] = a[i] + sum[i - 1];
  }
  int mx = 0, bsum = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      int second = intervalSum(i, j);
      if (used[second] == 1) continue;
      for (int i = 1; i <= n; i++) {
        dp[i] = 0;
      }
      int curr = calc(1, second);
      if (curr > mx) {
        mx = curr;
        bsum = second;
        for (int i = 1; i <= n; i++) {
          bdp[i] = dp[i];
        }
      }
      used[second] = 1;
    }
  }
  vector<pair<int, int> > v = print(bsum);
  printf("%d\n", v.size());
  for (auto& x : v) {
    printf("%d %d\n", x.first, x.second);
  }
  return 0;
}
