#include <bits/stdc++.h>
using namespace std;
const int maxa = 100005;
int a[maxa], b[maxa];
int ans[maxa][2];
struct point {
  int s, t;
} pp[maxa];
int cmp(point aa, point bb) {
  if (aa.s != bb.s) return aa.s < bb.s;
  return aa.t < bb.t;
}
int main() {
  int n;
  scanf("%d", &n);
  int p = 0, q = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    if (x == 1) {
      a[i] = ++p;
      b[i] = q;
    } else {
      a[i] = p;
      b[i] = ++q;
    }
  }
  int o = 0;
  for (int i = 1; i <= n; i++) {
    int a_win = 0, b_win = 0;
    int k = 0;
    int oo = 1;
    while (1) {
      int aa = lower_bound(a + 1, a + n + 1, a[k] + i) - a;
      int bb = lower_bound(b + 1, b + n + 1, b[k] + i) - b;
      if (aa == n + 1 && bb == n + 1) break;
      if (aa < bb) {
        a_win++;
        k = aa;
      } else if (aa > bb) {
        b_win++;
        k = bb;
      }
      if (aa == n && bb == n + 1) {
        if (a_win > b_win) {
          ans[o][0] = i;
          ans[o++][1] = a_win;
        }
        break;
      }
      if (bb == n && aa == n + 1) {
        if (b_win > a_win) {
          ans[o][0] = i;
          ans[o++][1] = b_win;
        }
        break;
      }
    }
  }
  printf("%d\n", o);
  for (int i = 0; i < o; i++) {
    pp[i].s = ans[i][1];
    pp[i].t = ans[i][0];
  }
  sort(pp, pp + o, cmp);
  for (int i = 0; i < o; i++) {
    printf("%d %d\n", pp[i].s, pp[i].t);
  }
  return 0;
}
