#include <bits/stdc++.h>
using namespace std;
int n;
int a[200007];
int sum[2][200007 << 1];
int pos[2][200007 << 1];
struct Node {
  int t, s;
  bool operator==(const Node& p) const { return t == p.t && s == p.s; }
} out[200007];
bool C(Node p, Node q) { return p.s < q.s || (p.s == q.s && p.t < q.t); }
int check(int t) {
  int s0, s1, cur, next;
  cur = 0;
  s0 = s1 = 0;
  while (cur < n) {
    next = -1;
    if (pos[0][sum[0][cur] + t] != -1) next = pos[0][sum[0][cur] + t];
    if (pos[1][sum[1][cur] + t] != -1) {
      if (next == -1 || pos[1][sum[1][cur] + t] < next) {
        next = pos[1][sum[1][cur] + t];
      }
    }
    if (next == -1) return -1;
    if (sum[0][next] - sum[0][cur] > sum[1][next] - sum[1][cur]) {
      ++s0;
    } else if (sum[0][next] - sum[0][cur] < sum[1][next] - sum[1][cur]) {
      ++s1;
    } else {
      return -1;
    }
    cur = next;
  }
  if (a[n] == 0 && s0 <= s1) return -1;
  if (a[n] == 1 && s0 >= s1) return -1;
  return ((s0) > (s1) ? (s0) : (s1));
}
int main() {
  int i, t, s;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    --a[i];
  }
  memset(sum, 0, sizeof(sum));
  memset(pos, -1, sizeof(pos));
  for (i = 1; i <= n; ++i) {
    sum[0][i] = sum[0][i - 1], sum[1][i] = sum[1][i - 1];
    pos[a[i]][++sum[a[i]][i]] = i;
  }
  int ans = 0;
  for (i = 1; i <= n; ++i)
    if (sum[0][i] != sum[1][i]) {
      t = ((sum[0][i]) > (sum[1][i]) ? (sum[0][i]) : (sum[1][i]));
      s = check(t);
      if (s != -1) out[ans].t = t, out[ans].s = s, ++ans;
    }
  sort(out, out + ans, C);
  ans = unique(out, out + ans) - out;
  printf("%d\n", ans);
  for (i = 0; i < ans; ++i) printf("%d %d\n", out[i].s, out[i].t);
  return 0;
}
