#include <bits/stdc++.h>
using namespace std;
struct option {
  option(){};
  option(int ss, int tt) : s(ss), t(tt){};
  int s, t;
  bool operator<(const option &o) const {
    return (s == o.s) ? t < o.t : s < o.s;
  }
} op[200005];
int main() {
  int n, cnt;
  int record[200005];
  int pn[200005], gn[200005];
  int pw[200005], gw[200005];
  int petya, gena;
  int p, g, m;
  bool able;
  int last;
  memset(record, 0, sizeof(record));
  memset(op, 0, sizeof(op));
  memset(pn, 0, sizeof(pn));
  memset(gn, 0, sizeof(gn));
  memset(pw, 0, sizeof(pw));
  memset(gw, 0, sizeof(gw));
  petya = gena = 0;
  cnt = 0;
  scanf("%d", &n);
  for (int i = 0; i < 200005; ++i) {
    pn[i] = gn[i] = pw[i] = gw[i] = (0x7fffffff);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &record[i]);
    switch (record[i]) {
      case 1: {
        pw[++petya] = i;
        break;
      }
      case 2: {
        gw[++gena] = i;
        break;
      }
    }
    pn[i] = petya;
    gn[i] = gena;
  }
  for (int t = 1; t <= n; ++t) {
    p = g = t;
    last = 0;
    petya = gena = 0;
    while (1) {
      if (pw[p] < gw[g]) {
        ++petya;
        last = 1;
        if (gn[pw[p]] + p == n) break;
        g = gn[pw[p]] + t;
        p = p + t;
      } else if (gw[g] < pw[p]) {
        ++gena;
        last = 2;
        if (pn[gw[g]] + g == n) break;
        p = pn[gw[g]] + t;
        g = g + t;
      } else {
        last = 0;
        break;
      }
    }
    if (last) {
      if (petya > gena && last == 1) {
        op[cnt] = option(petya, t);
        ++cnt;
      } else if (gena > petya && last == 2) {
        op[cnt] = option(gena, t);
        ++cnt;
      }
    }
  }
  sort(op, op + cnt);
  printf("%d\n", cnt);
  for (int i = 0; i < cnt; ++i) printf("%d %d\n", op[i].s, op[i].t);
}
