#include <bits/stdc++.h>
using namespace std;
int arr[51];
map<int, vector<pair<int, int> > > my;
map<int, vector<pair<int, int> > >::iterator it;
vector<pair<int, int> > ans;
bool comp(const pair<int, int> &A, pair<int, int> &B) {
  return A.second < B.second;
}
void solve(vector<pair<int, int> > v) {
  sort(v.begin(), v.end(), comp);
  vector<pair<int, int> > temp;
  int sz = (int)v.size();
  temp.push_back(v[0]);
  for (int i = 1; i < sz; ++i) {
    if (temp.back().second < v[i].first) temp.push_back(v[i]);
  }
  sz = (int)temp.size();
  if (sz > (int)ans.size()) {
    ans = temp;
  }
}
int main() {
  cin.sync_with_stdio(false);
  int n;
  cin >> n;
  int x;
  for (int i = 1; i <= n; ++i) {
    cin >> x;
    arr[i] = x;
  }
  for (int i = 1; i <= n; ++i) {
    int sum = 0;
    for (int j = i; j <= n; ++j) {
      sum += arr[j];
      my[sum].push_back({i, j});
    }
  }
  for (it = my.begin(); it != my.end(); ++it) {
    solve(it->second);
  }
  cout << ans.size() << endl;
  for (int i = 0; i < (int)ans.size(); ++i) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
}
