#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
vector<pair<int, int>> ret;
void solve(vector<pair<int, int>>& a) {
  int last = -1;
  vector<pair<int, int>> cur;
  for (auto& it : a) {
    if (it.first < last) continue;
    cur.push_back(it);
    last = it.second;
  }
  if (ret.size() < cur.size()) {
    ret = cur;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n + 1);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    a[i + 1] = a[i] + x;
  }
  map<int, vector<pair<int, int>>> A;
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j < i; ++j) {
      A[a[i] - a[j]].push_back({j, i});
    }
  }
  for (auto& it : A) {
    solve(it.second);
  }
  printf("%d\n", (int)ret.size());
  for (auto& it : ret) {
    printf("%d %d\n", it.first + 1, it.second);
  }
  return 0;
}
