#include <bits/stdc++.h>
using namespace std;
long long mult(long long a, long long b, long long p = 1000000007) {
  long long ans = a;
  ans *= b;
  return ((ans >= p) ? ans % p : ans);
}
long long add(long long a, long long b, long long p = 1000000007) {
  long long ans = a + b;
  return ((ans >= p) ? ans - p : ans);
}
long long fpow(long long n, long long k, long long p = 1000000007) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
long long inv(long long a, long long p = 1000000007) {
  return fpow(a, p - 2, p);
}
int n;
map<int, vector<pair<int, int> > > store;
bool comp(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.second != b.second)
    return a.second < b.second;
  else
    return a.first < b.first;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  vector<int> arr(n);
  vector<int> presum(n + 1, 0);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    presum[i + 1] = presum[i] + arr[i];
  }
  for (int i = 0; i < n + 1; i++) {
    for (int j = i + 1; j < n + 1; j++) {
      int sums = presum[j] - presum[i];
      auto it = store.find(sums);
      if (it == store.end()) {
        vector<pair<int, int> > temp;
        temp.push_back({i + 1, j});
        store[sums] = temp;
      } else
        it->second.push_back({i + 1, j});
    }
  }
  int maxans = 0, maxind = -1;
  for (auto &e : store) {
    int locmax = 0;
    int curfirst = -1, cursecond = -1;
    sort(e.second.begin(), e.second.end(), comp);
    for (auto &ee : e.second) {
      if (ee.first <= cursecond)
        continue;
      else {
        locmax++;
        curfirst = ee.first;
        cursecond = ee.second;
      }
    }
    if (locmax > maxans) {
      maxans = locmax;
      maxind = e.first;
    }
  }
  cout << maxans << endl;
  auto it = store.find(maxind);
  int curfirst = -1, cursecond = -1;
  for (auto &ee : it->second) {
    if (ee.first <= cursecond)
      continue;
    else {
      curfirst = ee.first;
      cursecond = ee.second;
      cout << curfirst << " " << cursecond << endl;
    }
  }
  return 0;
}
