#include <bits/stdc++.h>
using namespace std;
const int N = 55;
long long a[N];
map<long long, vector<pair<int, int> > > cnt;
int n;
vector<pair<int, int> > max_not_overlap(vector<pair<int, int> > v1) {
  sort((v1).begin(), (v1).end(), [](pair<int, int> a, pair<int, int> b) {
    if (a.second != b.second) {
      return a.second < b.second;
    }
    return a.first < b.first;
  });
  vector<pair<int, int> > v2;
  int last = 0;
  for (int i = (0); i <= (((int)(v1).size()) - 1); i += (+1)) {
    if (last < v1[i].first) {
      v2.push_back(v1[i]);
      last = v1[i].second;
    }
  }
  return v2;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
  cin >> n;
  for (int i = (1); i <= ((n)); i += (+1)) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  for (int l = (1); l <= ((n)); l += (+1)) {
    for (int r = (l); r <= (n); r += (+1)) {
      long long sum = a[r] - a[l - 1];
      cnt[sum].push_back({l, r});
    }
  }
  for (auto &it : cnt) {
    it.second = max_not_overlap(it.second);
  }
  long long sum = 0;
  for (auto &[nsum, v] : cnt) {
    if ((int)(v).size() > (int)(cnt[sum]).size()) {
      sum = nsum;
    }
  }
  cout << (int)(cnt[sum]).size() << '\n';
  for (auto &[l, r] : cnt[sum]) {
    cout << l << " " << r << '\n';
  }
  return 0;
}
