#include <bits/stdc++.h>
using namespace std;
struct Ans {
  int s, t;
  Ans() {}
  Ans(int a, int b) {
    s = a;
    t = b;
  }
  bool operator<(Ans x) const { return s != x.s ? s < x.s : t < x.t; }
};
vector<Ans> ans;
int in[100010];
int as[100010];
int ap[200010];
int bs[100010];
int bp[200010];
int n;
void maketable() {
  int i, x, y;
  x = y = 0;
  memset(ap, -1, sizeof(ap));
  memset(bp, -1, sizeof(bp));
  for (i = 0; i < n; i++) {
    if (in[i] == 1)
      ap[++x] = i;
    else
      bp[++y] = i;
    as[i] = x;
    bs[i] = y;
  }
}
int isok(int s) {
  int t1, t2, x, y;
  t1 = t2 = s;
  x = y = 0;
  while (1) {
    if (ap[t1] == -1 && bp[t2] == -1) return 0;
    if (ap[t1] == n - 1 && bp[t2] == -1) {
      ++x;
      return x <= y ? 0 : x;
    }
    if (ap[t1] == -1 && bp[t2] == n - 1) {
      ++y;
      return y <= x ? 0 : y;
    }
    if (bp[t2] == -1 || (ap[t1] != -1 && ap[t1] < bp[t2])) {
      t2 = bs[ap[t1]] + s;
      t1 += s;
      x++;
    } else if (ap[t1] == -1 || (bp[t2] != -1 && ap[t1] > bp[t2])) {
      t1 = as[bp[t2]] + s;
      t2 += s;
      y++;
    } else
      return 0;
  }
}
int main() {
  int i, t, m;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", in + i);
  maketable();
  for (i = 1; i <= n; i++) {
    t = isok(i);
    if (t != 0) ans.push_back(Ans(t, i));
  }
  sort(ans.begin(), ans.end());
  m = ans.size();
  printf("%d\n", m);
  for (i = 0; i < m; i++) printf("%d %d\n", ans[i].s, ans[i].t);
}
