#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300111;
int pet[MAXN], gen[MAXN];
int t1[MAXN];
int sg[MAXN], sp[MAXN];
int ost[MAXN];
vector<int> chk[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  int pp = 0, gg = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t1[i]);
    if (t1[i] == 1)
      pp++, pet[pp] = i;
    else
      gg++, gen[gg] = i;
  }
  for (int i = pp + 1; i <= 3 * n; i++) pet[i] = n + 1;
  for (int i = gg + 1; i <= 3 * n; i++) gen[i] = n + 1;
  for (int i = 1; i <= n; i++) chk[0].push_back(i);
  int gn = 0, pn = 0;
  for (int i = 0; i < n; i++) {
    if (t1[i] == 1) pn++;
    if (t1[i] == 2) gn++;
    for (auto k : chk[i]) {
      int pw = min(pet[pn + k], gen[gn + k]);
      if (pw > n) continue;
      if (pet[pn + k] < gen[gn + k])
        sp[k]++, ost[k] = 1;
      else
        sg[k]++, ost[k] = 2;
      chk[pw].push_back(k);
    }
    chk[i].clear();
  }
  vector<pair<int, int> > odp;
  for (auto k : chk[n]) {
    if (sp[k] != sg[k]) {
      if (ost[k] == 1 && sg[k] > sp[k]) continue;
      if (ost[k] == 2 && sp[k] > sg[k]) continue;
      odp.emplace_back(max(sp[k], sg[k]), k);
    }
  }
  if (odp.empty()) {
    puts("0");
    return 0;
  }
  sort(odp.begin(), odp.end());
  printf("%d\n", odp.size());
  for (auto k : odp) {
    int a, b;
    tie(a, b) = k;
    printf("%d %d\n", a, b);
  }
  return 0;
}
