#include <bits/stdc++.h>
using namespace std;
const int maxn = 1510;
map<int, vector<pair<int, int> > > d;
int arr[maxn], n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    int sum = 0;
    for (int j = i; j >= 1; j--) {
      sum += arr[j];
      d[sum].push_back(make_pair(j, i));
    }
  }
  int value = 0, ind = 0;
  for (auto i : d) {
    int l = 0, r = 0;
    int br = 0;
    for (auto j : d[i.first]) {
      if (j.first > r) {
        l = j.first;
        r = j.second;
        br++;
      }
    }
    if (br > value) {
      value = br;
      ind = i.first;
    }
  }
  cout << value << "\n";
  int l = 0, r = 0;
  for (auto j : d[ind]) {
    if (j.first > r) {
      cout << j.first << " " << j.second << "\n";
      l = j.first;
      r = j.second;
    }
  }
  return 0;
}
