#include <bits/stdc++.h>
using namespace std;
int bs(int a[], int val, int n) {
  int i = 0, j = n - 1;
  int mid = (i + j) / 2;
  while (i <= j) {
    if (a[mid] < val) i = mid + 1;
    if (a[mid] == val) {
      if (mid != 0 && a[mid - 1] == val)
        j = mid - 1;
      else
        return mid;
    }
    if (a[mid] > val) j = mid - 1;
    mid = (i + j) / 2;
  }
  return 2e9;
}
struct q {
  int s;
  int t;
};
bool comp(const q &a, const q &b) {
  if (a.s == b.s)
    return a.t < b.t;
  else
    return a.s < b.s;
}
int main() {
  q point[100001];
  int a1[100001], a2[100001], n, i, j, k;
  int x = 0, y = 0, res, re = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> k;
    if (k == 1)
      x++;
    else
      y++;
    a1[i] = x;
    a2[i] = y;
  }
  for (i = 1; i <= n; i++) {
    res = 0;
    int res1 = 0;
    x = y = 0;
    j = k = 0;
    while (1) {
      x = bs(a1, j + i, n);
      y = bs(a2, k + i, n);
      if (x > n && y > n) break;
      if (x < y)
        res++;
      else
        res1++;
      if (x == n - 1 && x < y && res > res1) {
        point[re++].s = res;
        point[re - 1].t = i;
        break;
      }
      if (y == n - 1 && x > y && res < res1) {
        point[re++].s = res1;
        point[re - 1].t = i;
        break;
      }
      j = a1[min(x, y)];
      k = a2[min(x, y)];
    }
  }
  sort(point, point + re, comp);
  cout << re << endl;
  for (i = 0; i < re; i++) cout << point[i].s << " " << point[i].t << endl;
}
