#include <bits/stdc++.h>
using namespace std;
mt19937 rng(time(0));
uniform_int_distribution<int> uid(-1e9, 1e9);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> v(n + 1, 0);
  map<int, vector<vector<int>>> mp;
  for (int i = 1; i <= n; ++i) cin >> v[i], v[i] += v[i - 1];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= i; ++j) mp[v[i] - v[j - 1]].push_back({j, i});
  vector<vector<int>> res;
  for (auto& i : mp) {
    sort((i.second).begin(), (i.second).end(),
         [](vector<int>& x, vector<int>& y) { return x[1] < y[1]; });
    int p = -1e9, k = 0;
    for (auto& j : i.second)
      if (j[0] > p) ++k, p = j[1];
    if (res.size() < k) {
      res.clear();
      p = -1e9;
      for (auto& j : i.second)
        if (j[0] > p) res.push_back(j), p = j[1];
    }
  }
  cout << res.size() << '\n';
  for (auto& i : res) cout << i[0] << ' ' << i[1] << '\n';
}
