#include <bits/stdc++.h>
using namespace std;
struct ans {
  int s, t;
};
const int nmax = 100006;
int n, v[nmax], s1[nmax], s2[nmax], rasp, acts, fp1[nmax], fp2[nmax];
ans vrasp[nmax];
bool ver;
int compar(ans a, ans b) {
  if (a.t != b.t)
    return a.t < b.t;
  else
    return a.s < b.s;
}
int main() {
  int player_unu = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    s1[i] = s1[i - 1];
    s2[i] = s2[i - 1];
    if (v[i] == 1) {
      s1[i]++;
      fp1[s1[i]] = i;
    } else {
      s2[i]++;
      fp2[s2[i]] = i;
    }
  }
  if (v[n] == 2)
    for (int i = 1; i <= n; i++) {
      v[i] = 3 - v[i];
      swap(s1[i], s2[i]);
      swap(fp1[i], fp2[i]);
    }
  for (int i = n; i > 0; i--) {
    if (s1[n] - s1[i - 1] > s2[n] - s2[i - 1] && v[i] == 1) {
      acts = s1[n] - s1[i - 1];
      int nrs1 = 0, nrs2 = 0, pozact = i;
      ver = 0;
      for (int j = 0; j < n;) {
        if (s1[j] + acts > s1[n] && s2[j] + acts > s2[n]) {
          ver = 1;
          break;
        }
        if (s2[j] + acts > s2[n]) {
          nrs1++;
          j = fp1[s1[j] + acts];
          continue;
        }
        if (s1[j] + acts > s1[n]) {
          nrs2++;
          j = fp2[s2[j] + acts];
          continue;
        }
        if (fp1[s1[j] + acts] < fp2[s2[j] + acts]) {
          nrs1++;
          j = fp1[s1[j] + acts];
        } else {
          nrs2++;
          j = fp2[s2[j] + acts];
        }
      }
      if (ver == 0 && nrs1 > nrs2) {
        vrasp[rasp].s = acts;
        vrasp[rasp].t = nrs1;
        rasp++;
      }
    }
  }
  sort(vrasp, vrasp + rasp, compar);
  cout << rasp << '\n';
  for (int i = 0; i < rasp; i++)
    cout << vrasp[i].t << ' ' << vrasp[i].s << '\n';
  return player_unu;
}
