#include <bits/stdc++.h>
using namespace std;
map<int, vector<pair<int, int>>> m;
bool cmp(pair<int, int> &a, pair<int, int> &b) { return a.second < b.second; }
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    int sum = 0;
    for (int j = i; j < n; j++) {
      sum += a[j];
      m[sum].push_back({i, j});
    }
  }
  for (auto &x : m) {
    sort(x.second.begin(), x.second.end(), cmp);
  }
  int ans = 0, sans;
  for (auto x : m) {
    vector<pair<int, int>> &p = x.second;
    int val = 1, la = p[0].second;
    for (int i = 1; i < p.size(); i++) {
      if (p[i].first > la) {
        la = p[i].second;
        val++;
      }
    }
    if (ans < val) {
      ans = val;
      sans = x.first;
    }
  }
  cout << ans << endl;
  vector<pair<int, int>> &p = m[sans];
  int la = p[0].second;
  cout << p[0].first + 1 << " " << p[0].second + 1 << endl;
  for (int i = 1; i < p.size(); i++) {
    if (p[i].first > la) {
      la = p[i].second;
      cout << p[i].first + 1 << " " << p[i].second + 1 << endl;
    }
  }
  return 0;
}
