#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
int n, cnt1[100001], cnt2[100001], t, i, tot[3], p1, p2, t1, t2, ANS;
pair<int, int> ans[1000001];
int find(int a[100001], int x) {
  int l, r, mid;
  l = 1;
  r = n;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (a[mid] < x)
      l = mid + 1;
    else
      r = mid - 1;
    if (a[mid] == x && a[mid - 1] != x) return mid;
  }
  return 12345678;
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    cnt1[i] = cnt1[i - 1];
    cnt2[i] = cnt2[i - 1];
    scanf("%d", &t);
    tot[t]++;
    if (t == 1)
      cnt1[i]++;
    else
      cnt2[i]++;
  }
  t = max(tot[1], tot[2]);
  for (i = t; i >= 1; i--) {
    t = t1 = t2 = tot[1] = tot[2] = 0;
    while (t < n) {
      p1 = find(cnt1, tot[1] + i);
      p2 = find(cnt2, tot[2] + i);
      t = min(p1, p2);
      if (t != 12345678) {
        tot[1] = cnt1[t];
        tot[2] = cnt2[t];
        if (p1 < p2)
          t1++;
        else if (p1 > p2)
          t2++;
        else
          break;
      }
    }
    if ((t == n && t1 != t2) && (n == 1 || (t1 > t2 && cnt1[n] > cnt1[n - 1]) ||
                                 (t1 < t2 && cnt2[n] > cnt2[n - 1]))) {
      ANS++;
      ans[ANS] = {max(t1, t2), i};
    }
  }
  sort(ans + 1, ans + ANS + 1);
  printf("%d\n", ANS);
  for (i = 1; i <= ANS; i++) printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
