#include <bits/stdc++.h>
using namespace std;
int a[10001];
int main() {
  int i, j, k, t = 0, ans = 0, n;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) {
    for (j = i; j <= n; j++) {
      t += a[j];
      if (t == 0) {
        ans++;
        printf("%d %d\n", i, j);
      }
    }
    t = 0;
  }
  printf("%d", ans);
  return 0;
}
