#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, d, max = -2, sum, sum1, ans, c, z, x;
  cin >> n;
  int a[n];
  map<long long, int> m, m1;
  for (i = 0; i < n; i++) cin >> a[i];
  set<long long> s;
  sum1 = 0;
  for (i = 0; i < n; i++) {
    j = 0;
    sum1 += a[i];
    if (m.find(sum1) == m.end()) {
      m[sum1] = i;
      m1[sum1] = 1;
    }
    sum = 0;
    while (j < i) {
      sum += a[j++];
      if (m.find(sum1 - sum) != m.end()) {
        if (m[sum1 - sum] < j) {
          m1[sum1 - sum]++;
          m[sum1 - sum] = i;
        }
      } else {
        m[sum1 - sum] = i;
        m1[sum1 - sum] = 1;
      }
    }
  }
  while (m1.size()) {
    auto it = m1.begin();
    if (it->second > max) {
      max = it->second;
      ans = it->first;
    }
    m1.erase(it->first);
  }
  cout << max << "\n";
  sum = ans;
  sum1 = 0;
  m.clear();
  m[0] = -1;
  for (z = 0; z < n; z++) {
    sum1 += a[z];
    if (m.find(sum1 - sum) != m.end()) {
      c++;
      cout << m[sum1 - sum] + 2 << " " << z + 1 << "\n";
      m.clear();
      sum1 = 0;
    }
    m[sum1] = z;
  }
  return 0;
}
