#include <bits/stdc++.h>
using namespace std;
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
map<int, vector<pair<int, int> > > dp;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) a[i] = in();
  vector<int> s(n + 1);
  for (int i = 0; i < n; ++i) s[i + 1] = s[i] + a[i];
  for (int j = 1; j <= n; ++j)
    for (int i = 0; i < j; ++i) {
      int x = s[j] - s[i];
      if (dp.count(x) == 0 || dp[x].back().second <= i) {
        dp[x].push_back(pair<int, int>(i, j));
      }
    }
  vector<pair<int, int> > ans;
  for (auto tmp : dp) {
    if (tmp.second.size() > ans.size()) ans = tmp.second;
  }
  cout << ans.size() << endl;
  for (pair<int, int> p : ans) cout << p.first + 1 << " " << p.second << endl;
  return 0;
}
