#include <bits/stdc++.h>
using namespace std;
const int N = 55, M = 1000005;
const long long MOD = 1e9 + 7;
const double eps = 1e-9;
int n, a[N];
pair<int, int> best[N];
map<int, vector<pair<int, int> > > mp;
vector<vector<int> > e;
vector<pair<int, int> > ans;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 1; i < n; i++) a[i] += a[i - 1];
  for (int i = 0; i < n; i++)
    for (int j = i; j < n; j++) {
      int s = a[j] - (i ? a[i - 1] : 0);
      if (mp.find(s) == mp.end()) mp[s] = vector<pair<int, int> >();
      mp[s].push_back(make_pair(i + 1, j + 1));
    }
  for (auto it = mp.begin(); it != mp.end(); it++) {
    sort(it->second.begin(), it->second.end());
    e.clear();
    e.resize(n + 1);
    for (int i = 0; i < it->second.size(); i++)
      e[it->second[i].second].push_back(it->second[i].first);
    best[0] = make_pair(0, 0);
    for (int i = 1; i <= n; i++) {
      best[i] = make_pair(best[i - 1].first, -1);
      for (int j = 0; j < e[i].size(); j++)
        if (best[e[i][j] - 1].first + 1 > best[i].first)
          best[i] = make_pair(best[e[i][j] - 1].first + 1, e[i][j]);
    }
    if (best[n].first > ans.size()) {
      ans.clear();
      int i = n;
      while (i) {
        if (best[i].second == -1)
          i--;
        else {
          ans.push_back(make_pair(best[i].second, i));
          i = best[i].second - 1;
        }
      }
    }
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
