#include <bits/stdc++.h>
using namespace std;
map<int, vector<pair<int, int> > > s;
int sum[1550];
int ans_sum, ans_size = 0;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    sum[i] = sum[i - 1] + a;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i - 1; j >= 0; j--) {
      int num = sum[i] - sum[j];
      if (s[num].empty()) {
        s[num].push_back(make_pair(j + 1, i));
      } else {
        if (s[num][s[num].size() - 1].second < j + 1)
          s[num].push_back(make_pair(j + 1, i));
      }
      if (s[num].size() > ans_size) {
        ans_size = s[num].size();
        ans_sum = num;
      }
    }
  }
  cout << ans_size << endl;
  for (int i = 0; i < ans_size; i++) {
    cout << s[ans_sum][i].first << ' ' << s[ans_sum][i].second << endl;
  }
  return 0;
}
