#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b, long long m = 998244353) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % m;
    a = (a * a) % m;
    b >>= 1;
  }
  return res;
}
long long inverse(long long a, long long m = 998244353) {
  return power(a, m - 2, m);
}
vector<pair<int, int> > solve(vector<pair<int, int> > second) {
  int n = second.size();
  set<pair<int, int> > ss(second.begin(), second.end());
  int curr = -1;
  vector<pair<int, int> > res;
  while (!ss.empty()) {
    pair<int, int> x = *ss.begin();
    if (x.second > curr) {
      res.push_back(x);
      curr = x.first;
    } else
      ss.erase(ss.begin());
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, vector<pair<int, int> > > mm;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int sum = 0;
    for (int j = i; j < n; j++) {
      sum += a[j];
      mm[sum].push_back(make_pair(j, i));
    }
  }
  vector<pair<int, int> > res;
  for (auto it : mm) {
    vector<pair<int, int> > temp = solve(it.second);
    if (temp.size() > res.size()) res = temp;
  }
  cout << res.size() << endl;
  for (pair<int, int> x : res) {
    cout << x.second + 1 << ' ' << x.first + 1 << endl;
  }
}
