#include <bits/stdc++.h>
using namespace std;
long long a[1000];
map<long long, long long> c1;
long long b[1000];
map<long long, long long> c2;
int main() {
  long long n, x1 = 0, an = 0, anss, i, j, j2, j1, maxn = 0, minn = 2e18, p;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = b[i - 1] + a[i];
  }
  j1 = 1;
  for (j = 1; j <= n; j++) {
    for (j2 = 1; j2 <= j; j2++) {
      p = b[j] - b[j2 - 1];
      if (c2[p] < j2) {
        c1[p]++;
        if (c1[p] > an) {
          an = c1[p];
          anss = p;
        }
        c2[p] = j;
      }
    }
  }
  cout << an << endl;
  j1 = 1;
  for (i = 1; i <= n; i++) {
    for (j2 = j1; j2 <= i; j2++) {
      if ((b[i] - b[j2 - 1]) == anss) {
        cout << j2 << " " << i << endl;
        j1 = i + 1;
        break;
      }
    }
  }
}
