#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int a[maxn];
int sum1[maxn];
int sum2[maxn];
int cnt1, cnt2;
struct node {
  int s;
  int t;
  node(int ss, int tt) {
    s = ss;
    t = tt;
  }
  node() {}
} ANS[100010];
bool cmp(node a, node b) {
  if (a.s == b.s) {
    return a.t < b.t;
  }
  return a.s < b.s;
}
int bisearch(int t, int l, int r, int& pos) {
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (sum1[mid] - cnt1 < t && sum2[mid] - cnt2 < t) {
      l = mid + 1;
      continue;
    }
    if (sum1[mid] - cnt1 == t && sum2[mid] - cnt2 < t && a[mid] == 1) {
      pos = mid;
      return 1;
    }
    if (sum2[mid] - cnt2 == t && sum1[mid] - cnt1 < t && a[mid] == 2) {
      pos = mid;
      return 2;
    }
    r = mid - 1;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] == 1)
      sum1[i]++;
    else
      sum2[i]++;
  }
  for (int i = 1; i < n; i++) {
    sum1[i] += sum1[i - 1];
    sum2[i] += sum2[i - 1];
  }
  int win1;
  int win2;
  int s = 0;
  int num = 0;
  for (int t = 1; t <= n; t++) {
    cnt1 = cnt2 = 0;
    win1 = win2 = 0;
    int pos = 0;
    while (pos < n) {
      int winner = bisearch(t, pos, n - 1, pos);
      if (!winner) break;
      if (winner == 1) {
        cnt1 = sum1[pos];
        cnt2 = sum2[pos];
        win1++;
        if (pos == n - 1) {
          if (win1 > win2) {
            ANS[num] = node(win1, t);
            num++;
          }
          break;
        }
      }
      if (winner == 2) {
        cnt1 = sum1[pos];
        cnt2 = sum2[pos];
        win2++;
        if (pos == n - 1) {
          if (win1 < win2) {
            ANS[num] = node(win2, t);
            num++;
          }
          break;
        }
      }
      pos++;
    }
  }
  sort(ANS, ANS + num, cmp);
  cout << num << endl;
  for (int i = 0; i < num; i++) printf("%d %d\n", ANS[i].s, ANS[i].t);
  return 0;
}
