#include <bits/stdc++.h>
using namespace std;
int a[100005];
int sum1[100005];
int sum2[100005];
struct node {
  int s, t;
} rec[100005];
int cmp(node c, node b) {
  if (c.s == b.s) return c.t < b.t;
  return c.s < b.s;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  sum1[0] = sum2[0] = 0;
  for (int i = 1; i <= n; i++) {
    sum1[i] = sum1[i - 1] + (a[i - 1] == 1 ? 1 : 0);
    sum2[i] = sum2[i - 1] + (a[i - 1] == 2 ? 1 : 0);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int wh = 0;
    int score1, score2;
    score1 = score2 = 0;
    while (wh < n) {
      bool over = true;
      int j = i - 1, step = i;
      while (step) {
        if (wh + j + step > n) {
          step >>= 1;
          continue;
        }
        if (sum1[wh + j + step] - sum1[wh] >= i ||
            sum2[wh + j + step] - sum2[wh] >= i)
          step >>= 1;
        else
          j += step;
      }
      j++;
      if (wh + j > n) break;
      if (sum1[wh + j] - sum1[wh] == i) {
        score1++;
        wh = wh + j;
        over = false;
      } else if (sum2[wh + j] - sum2[wh] == i) {
        score2++;
        wh = wh + j;
        over = false;
      }
      if (over) break;
    }
    if (wh == n) {
      if (score1 != score2) {
        if ((score1 > score2 && a[n - 1] == 1) ||
            (score1 < score2 && a[n - 1] == 2)) {
          rec[ans].s = max(score1, score2);
          rec[ans].t = i;
          ans++;
        }
      }
    }
  }
  sort(rec, rec + ans, cmp);
  printf("%d\n", ans);
  for (int i = 0; i < ans; i++) printf("%d %d\n", rec[i].s, rec[i].t);
  return 0;
}
