#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int L[maxn], tot = 0;
int num[2][maxn], sum[2][maxn];
struct res_node {
  int s, t;
} res[maxn];
bool operator<(const res_node &a, const res_node &b) { return a.s < b.s; }
int main() {
  int n;
  cin >> n;
  memset(sum, 0, sizeof(sum));
  for (int i = 0; i < n; i++) {
    scanf("%d", &L[i]);
    sum[0][i] = sum[0][i - 1];
    sum[1][i] = sum[1][i - 1];
    sum[L[i] - 1][i]++;
    num[L[i] - 1][sum[L[i] - 1][i]] = i;
  }
  int sum0 = sum[0][n - 1];
  int sum1 = sum[1][n - 1];
  for (int i = 1; i <= n; i++) {
    int t1, t2;
    int s1, s2;
    int last_dir = -1;
    s1 = s2 = 0;
    t1 = t2 = 0;
    while (true) {
      int dir;
      if (t1 + i > sum0 && t2 + i > sum1) {
        if (s1 == s2 || t1 + t2 != n) break;
        res[tot].s = max(s1, s2);
        if (last_dir == 0)
          s1--;
        else
          s2--;
        if (s1 == res[tot].s || s2 == res[tot].s) break;
        res[tot].t = i;
        tot++;
        break;
      }
      if (t1 + i > sum0)
        dir = 1;
      else {
        if (t2 + i > sum1)
          dir = 0;
        else {
          if (num[0][t1 + i] < num[1][t2 + i])
            dir = 0;
          else
            dir = 1;
        }
      }
      if (dir == 0) {
        s1++;
        t1 += i;
        t2 = sum[1][num[0][t1]];
      } else {
        s2++;
        t2 += i;
        t1 = sum[0][num[1][t2]];
      }
      last_dir = dir;
    }
  }
  sort(res, res + tot);
  cout << tot << endl;
  for (int i = 0; i < tot; i++) {
    printf("%d %d\n", res[i].s, res[i].t);
  }
  return 0;
}
