#include <bits/stdc++.h>
using namespace std;
int a[100005];
int n;
int pa[100005], pb[100005];
struct node {
  int x, y;
};
node ans[100005];
bool cmp(node a, node b) {
  if (a.x != b.x) return a.x < b.x;
  return a.y < b.y;
}
int find(int x, int* b, int t) {
  int l = x, r = n, mid, v = b[x - 1] + t;
  while (l < r) {
    mid = (l + r) / 2;
    if (b[mid] < v) {
      l = mid + 1;
    } else {
      r = mid;
    }
  }
  if (b[r] < v) return 1000000000;
  return r;
}
int judge(int t) {
  int p = 1, x, y;
  int c1 = 0, c2 = 0;
  while (1) {
    x = find(p, pa, t);
    y = find(p, pb, t);
    if (x == 1000000000 && y == 1000000000) {
      break;
    }
    if (x < y) {
      c1++;
      p = x + 1;
    } else {
      c2++;
      p = y + 1;
    }
    if (p > n) break;
  }
  if (p <= n) return 0;
  if (c1 == c2) return 0;
  if (c1 > c2) {
    if (a[n] == 1) return c1;
    return 0;
  } else {
    if (a[n] == 2) return c2;
    return 0;
  }
}
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    pa[i] = pa[i - 1];
    pb[i] = pb[i - 1];
    if (a[i] == 1)
      pa[i]++;
    else
      pb[i]++;
  }
  int cnt = 0, t;
  for (i = 1; i <= n; i++) {
    if (t = judge(i)) {
      cnt++;
      ans[cnt].x = t;
      ans[cnt].y = i;
    }
  }
  printf("%d\n", cnt);
  sort(ans + 1, ans + cnt + 1, cmp);
  for (i = 1; i <= cnt; i++) {
    printf("%d %d\n", ans[i].x, ans[i].y);
  }
  return 0;
}
