#include <bits/stdc++.h>
using namespace std;
struct node {
  int s, t;
} ans[200000];
int n, m(0);
int a[200005], sum1[200000], sum2[200000], time1[200000], time2[200000];
inline bool cmp(node l, node r) {
  return (l.s < r.s || (l.s == r.s && l.t < r.t));
}
int main() {
  cin >> n;
  sum1[0] = sum1[0] = time1[0] = time2[0] = 0;
  int t1 = 0, t2 = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum1[i] = sum1[i - 1] + ((a[i] == 1) ? 1 : 0);
    sum2[i] = sum2[i - 1] + ((a[i] == 2) ? 1 : 0);
    if (a[i] == 1) time1[++t1] = i;
    if (a[i] == 2) time2[++t2] = i;
  }
  for (int t = 1; t <= n; t++) {
    int s1, s2, i, k1, k2;
    s1 = s2 = i = k1 = k2 = 0;
    int last = 0;
    bool flag = true;
    while (i < n) {
      if (k1 + t > t1 && k2 + t > t2) {
        flag = false;
        break;
      }
      int l1 = (k1 + t <= t1) ? time1[k1 + t] : 100000000;
      int l2 = (k2 + t <= t2) ? time2[k2 + t] : 100000000;
      if (l1 < l2)
        s1++, last = 1;
      else
        s2++, last = 2;
      i = min(l1, l2);
      k1 = sum1[i];
      k2 = sum2[i];
    }
    if (!flag || s1 == s2 || last != ((s1 > s2) ? 1 : 2)) continue;
    node tmp;
    tmp.s = max(s1, s2);
    tmp.t = t;
    ans[++m] = tmp;
  }
  sort(ans + 1, ans + m + 1, cmp);
  cout << m << endl;
  for (int i = 1; i <= m; i++) printf("%d %d\n", ans[i].s, ans[i].t);
}
