#include <bits/stdc++.h>
using namespace std;
int n;
int sum[100009][2];
int cntansw;
struct answ {
  int s, t;
} atb[100009];
int BinSearch(int mem, int t) {
  int l = mem + 1;
  int r = n;
  int mid;
  int a;
  while (l <= r) {
    mid = (l + r) / 2;
    a = max(sum[mid][0] - sum[mem][0], sum[mid][1] - sum[mem][1]);
    if (a < t)
      l = mid + 1;
    else
      r = mid - 1;
  }
  r++;
  return r;
}
int compare(const void* a, const void* b) {
  if (((answ*)a)->s == ((answ*)b)->s)
    return (((answ*)a)->t - ((answ*)b)->t);
  else
    return (((answ*)a)->s - ((answ*)b)->s);
}
int main() {
  sum[0][0] = sum[0][1] = 0;
  scanf("%d", &n);
  int tmp;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &tmp);
    sum[i][0] = sum[i - 1][0];
    sum[i][1] = sum[i - 1][1];
    sum[i][tmp - 1]++;
  }
  cntansw = 0;
  int maxt = max(sum[n][0], sum[n][1]);
  int lastset = 0;
  int pointer = 0, mem;
  int seta, setb;
  bool ir;
  for (int t = 1; t <= maxt; t++) {
    pointer = 0;
    lastset = 0;
    seta = 0;
    setb = 0;
    while (pointer < n) {
      mem = pointer;
      pointer = BinSearch(pointer, t);
      if (pointer > n) {
      } else {
        if (sum[pointer][0] - sum[mem][0] == t) {
          seta++;
          lastset = 1;
        } else {
          setb++;
          lastset = 2;
        }
      }
    }
    if (pointer == n && seta != setb) {
      ir = false;
      if (seta > setb && lastset == 1)
        ir = true;
      else if (setb > seta && lastset == 2)
        ir = true;
      if (ir) {
        atb[cntansw].s = max(seta, setb);
        atb[cntansw].t = t;
        cntansw++;
      }
    }
  }
  qsort(atb, cntansw, sizeof(answ), compare);
  printf("%d\n", cntansw);
  for (int i = 0; i < cntansw; i++) {
    printf("%d %d\n", atb[i].s, atb[i].t);
  }
}
