#include <bits/stdc++.h>
#pragma GCC optimize("O3")
const double PI = acos(-1);
template <class A, class B>
std::ostream& operator<<(std::ostream& st, const std::pair<A, B> p) {
  st << "(" << p.first << ", " << p.second << ")";
  return st;
}
using namespace std;
map<int, vector<std::pair<int, int>>> M;
int n;
int A[2000];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n); i++) scanf("%d", A + i);
  for (int i = 0; i < n; i++) {
    for (int j = i, s = 0; j < n; j++) {
      s += A[j];
      M[s].emplace_back(j, i);
    }
  }
  vector<std::pair<int, int>> ans, aux;
  for (auto& [_, V] : M) {
    sort(V.begin(), V.end());
    aux.clear();
    int E = -1;
    for (auto [e, s] : V) {
      if (s <= E) continue;
      E = e;
      aux.emplace_back(s, e);
    }
    if (((int)aux.size()) > ((int)ans.size())) ans = aux;
  }
  printf("%d\n", ((int)ans.size()));
  for (auto [s, e] : ans) printf("%d %d\n", s + 1, e + 1);
  return 0;
}
