#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.1415926535897;
const long long mod = 1000000007LL;
const long long INF = 1e18;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> p{0};
  for (long long &i : a) cin >> i, p.push_back(p.back() + i);
  map<long long, vector<pair<long long, long long>>> mp;
  for (long long i = 0; i < n; i++) {
    for (long long j = i; j < n; j++) {
      mp[p[j + 1] - p[i]].push_back({j, i});
    }
  }
  long long jv = -1, yi = -1;
  for (auto &[x, y] : mp) {
    sort(y.begin(), y.end());
    long long jo = -1, jj = 0;
    for (long long i = 0; i < y.size(); i++) {
      if (y[i].second <= jo) continue;
      jj++;
      jo = y[i].first;
    }
    if (jv < jj) {
      jv = jj;
      yi = x;
    }
  }
  cout << jv << endl;
  auto y = mp[yi];
  long long jo = -1;
  for (long long i = 0; i < y.size(); i++) {
    if (y[i].second <= jo) continue;
    cout << y[i].second + 1 << " " << y[i].first + 1 << endl;
    jo = y[i].first;
  }
  return 0;
}
