#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int counter = 0;
  for (int i = 0; i < n; i++) {
    int sum_check = 0;
    for (int j = 0; j < n - i; j++) {
      sum_check += a[i + j];
      if (sum_check == 0) {
        counter++;
        cout << i << ' ' << j << endl;
      }
    }
  }
  cout << counter << endl;
  return 0;
}
