#include <bits/stdc++.h>
using namespace std;
int n, x, i, s1, s2, q, w, mn, ct, last1, last2, t, qwe;
int a[100005], b[100005], C[100005];
pair<int, int> A[100005];
int main() {
  cin >> n;
  memset(a, 10, sizeof a);
  memset(b, 10, sizeof b);
  for (i = 1; i <= n; i++) {
    cin >> x;
    C[i] = x;
    if (x == 1) ++s1;
    if (x == 2) ++s2;
    a[i] = s1;
    b[i] = s2;
  }
  last1 = 0;
  last2 = 0;
  for (t = 1; t <= n; t++) {
    s1 = s2 = last1 = last2 = 0;
    while (1) {
      q = lower_bound(a + 1, a + n + 1, last1 + t) - a;
      w = lower_bound(b + 1, b + n + 1, last2 + t) - b;
      if (q > n and w > n) break;
      mn = q;
      if (mn > w) {
        mn = w;
        s2++;
      } else
        s1++;
      if (mn == n) {
        if ((s1 > s2 and C[n] == 1) or (s2 > s1 and C[n] == 2)) {
          ct++;
          A[qwe].first = max(s1, s2);
          A[qwe++].second = t;
        }
        break;
      }
      last1 = a[mn];
      last2 = b[mn];
    }
  }
  cout << ct << endl;
  sort(A, A + qwe);
  for (i = 0; i < qwe; i++) cout << A[i].first << ' ' << A[i].second << endl;
  return 0;
}
