#include <bits/stdc++.h>
using namespace std;
const double eps(1e-8);
int n;
int s[201000], num[200010], a[200010], b[200010], nxt[200010][3];
vector<pair<int, int> > p;
int next(int cur, int t) {
  if (cur > n) return 0;
  int id = num[cur];
  if (s[cur] == 1) {
    return a[id + t - 1];
  } else {
    return b[id + t - 1];
  }
}
int calc(int t) {
  int w1 = 0, w2 = 0, cur = 1;
  while (cur != n + 1) {
    int p1 = next(nxt[cur][1], t);
    int p2 = next(nxt[cur][2], t);
    int nxt = n + 2;
    if (p1 != 0) nxt = p1 + 1;
    if (p2 != 0) nxt = min(nxt, p2 + 1);
    if (nxt == n + 2) return -1;
    if (s[nxt - 1] == 1) {
      w1++;
    } else {
      w2++;
    }
    cur = nxt;
  }
  if (w1 <= w2 && s[n] == 1) return -1;
  if (w1 >= w2 && s[n] == 2) return -1;
  if (s[n] == 1)
    return w1;
  else
    return w2;
}
int main() {
  scanf("%d", &n);
  int s1 = 0, s2 = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &s[i]);
    if (s[i] == 1) {
      num[i] = ++s1;
      a[s1] = i;
    } else {
      num[i] = ++s2;
      b[s2] = i;
    }
  }
  int l1 = n + 1, l2 = n + 1;
  for (int i = n; i >= 1; i--) {
    if (s[i] == 1)
      l1 = i;
    else
      l2 = i;
    nxt[i][1] = l1, nxt[i][2] = l2;
  }
  p.clear();
  for (int i = n; i >= 1; i--) {
    int j = calc(i);
    if (j != -1) {
      p.push_back(make_pair(j, i));
    }
  }
  sort(p.begin(), p.end());
  cout << p.size() << endl;
  for (int i = 0; i < (int)p.size(); i++) {
    printf("%d %d\n", p[i].first, p[i].second);
  }
  return 0;
}
