#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
const int N = 1510;
int n, x, s[N];
unordered_map<int, vector<pair<int, int>>> slr;
int main() {
  scanf("%d", &n);
  s[0] = 0;
  for (int i = (1); i <= (n); ++i) scanf("%d", &x), s[i] = s[i - 1] + x;
  for (int l = (1); l <= (n); ++l)
    for (int r = (l); r <= (n); ++r)
      slr[s[r] - s[l - 1]].push_back(make_pair(r, l));
  vector<pair<int, int>> ans;
  for (auto &ele : slr) {
    vector<pair<int, int>> lr = ele.second;
    sort(lr.begin(), lr.end());
    int nowr = -1;
    vector<pair<int, int>> tmp;
    for (auto x : lr)
      if (x.second > nowr) {
        tmp.push_back(x);
        nowr = x.first;
      }
    if (tmp.size() > ans.size()) ans = tmp;
  }
  printf("%d\n", ans.size());
  for (auto x : ans) printf("%d %d\n", x.second, x.first);
}
