#include <bits/stdc++.h>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;
template <class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
int main() {
  int n;
  cin >> n;
  map<int, vector<pair<int, int>>> m;
  vector<int> S(n + 1);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    S[i + 1] = S[i] + x;
  }
  for (int j = 0; j <= n; ++j) {
    for (int i = 0; i < j; ++i) {
      m[S[j] - S[i]].emplace_back(i, j);
    }
  }
  vector<pair<int, int>> ans;
  for (auto &&[k, v] : m) {
    vector<pair<int, int>> w;
    int c = 0;
    for (auto &&[l, r] : v) {
      if (c <= l) {
        w.emplace_back(l, r);
        c = r;
      }
    }
    if (ans.size() < w.size()) ans = w;
  }
  cout << ans.size() << "\n";
  for (auto &&[l, r] : ans) printf("%d %d\n", l + 1, r);
  return 0;
}
