#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " , ";
  __f(comma + 1, args...);
}
int main() {
  ios::sync_with_stdio(0);
  int n, i, j;
  cin >> n;
  int a[n];
  for (i = 0; i < n; ++i) cin >> a[i];
  map<long long, vector<pair<int, int> > > m;
  for (i = 0; i < n; ++i) {
    long long sum = 0;
    for (j = i; j < n; ++j) {
      sum += a[j];
      m[sum].push_back({j, i});
    }
  }
  int maxl = 0;
  int blocksum = 0;
  vector<pair<int, int> > ans;
  for (auto s : m) {
    auto v = s.second;
    sort(v.begin(), v.end());
    vector<pair<int, int> > temp;
    int r = -1;
    for (i = 0; i < v.size(); ++i) {
      if (v[i].second > r) {
        temp.push_back({v[i].second, v[i].first});
        r = v[i].first;
      }
    }
    if (temp.size() > maxl) {
      ans = temp;
      maxl = temp.size();
      blocksum = s.first;
    }
  }
  cout << ans.size() << "\n";
  for (auto x : ans) cout << x.first + 1 << " " << x.second + 1 << '\n';
  return 0;
}
