#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long sum[n + 1];
  sum[0] = 0;
  for (long long i = 1; i <= n; i++) cin >> sum[i], sum[i] += sum[i - 1];
  map<long long, vector<pair<long long, long long>>> m;
  for (long long i = 1; i <= n; i++)
    for (long long j = i; j <= n; j++)
      m[sum[j] - sum[i - 1]].push_back(make_pair(j, i));
  map<long long, vector<pair<long long, long long>>>::iterator ans, it;
  long long sets = 0;
  for (it = m.begin(); it != m.end(); it++) {
    sort(it->second.begin(), it->second.end());
    long long prev = 0, temp = 0;
    for (long long i = 0; i < it->second.size(); i++) {
      if (it->second[i].second > prev) {
        temp++;
        prev = it->second[i].first;
      }
    }
    if (sets < temp) {
      sets = temp;
      ans = it;
    }
  }
  cout << sets << "\n";
  long long prev = 0;
  for (long long i = 0; i < ans->second.size(); i++) {
    if (ans->second[i].second > prev) {
      cout << ans->second[i].second << " " << ans->second[i].first << "\n";
      prev = ans->second[i].first;
    }
  }
  return 0;
}
