#include <bits/stdc++.h>
using namespace std;
const int inf = numeric_limits<int>::max();
const long long linf = numeric_limits<long long>::max();
const int max_n = 51;
int n, a[max_n], sm[max_n][max_n];
bool comp(pair<int, pair<int, int>> a, pair<int, pair<int, int>> b) {
  if (a.first == b.first) {
    if (b.second.second < a.second.second) return false;
    if (b.second.second == a.second.second and b.second.first > a.second.first)
      return false;
    return true;
  } else
    return a.first < b.first;
}
int main(int argc, char **argv) {
  int s;
  cin >> n;
  for (int i = 0; i < (n); ++i) cin >> a[i];
  vector<pair<int, pair<int, int>>> v;
  vector<pair<int, int>> sol, csol;
  for (int i = 0; i < (n); ++i) {
    s = 0;
    for (int j = (i); j < (n); ++j) {
      s += a[j];
      sm[i][j] = s;
      v.push_back({s, {i, j}});
    }
  }
  sort(v.begin(), v.end(), comp);
  int x = -1, y = -1, curr = 0;
  for (auto &&i : v) {
    if (curr == i.first) {
      if (i.second.first > y) {
        y = i.second.second;
        x = i.second.first;
        csol.push_back(i.second);
      }
    } else {
      curr = i.first;
      y = i.second.second;
      x = i.second.first;
      csol.clear();
      csol.push_back(i.second);
    }
    if (csol.size() > sol.size()) sol = csol;
  }
  cout << sol.size() << endl;
  for (int i = 0; i < (sol.size()); ++i)
    cout << sol[i].first + 1 << " " << sol[i].second + 1 << endl;
  return 0;
}
