#include <bits/stdc++.h>
using namespace std;
const int MAX = 200005;
int n, a[100005], sum, ans;
map<int, vector<pair<int, int>>> m;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum = 0;
    for (int j = i; j >= 1; j--) {
      sum += a[j];
      if (m[sum].size() == 0 || m[sum].back().second < j)
        m[sum].push_back(make_pair(j, i));
      if (i == 1 || m[sum].size() > m[ans].size()) ans = sum;
    }
  }
  cout << m[ans].size() << "\n";
  for (auto p : m[ans]) cout << p.first << " " << p.second << "\n";
  return 0;
}
