#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9);
const int MaxN = int(1e5) + 256;
int n, a[MaxN], b[MaxN], A, B, s, t, c[MaxN], cnt, pos;
pair<int, int> p[MaxN];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == 1) {
      b[i] = b[i - 1] + 1;
      c[i] = c[i - 1];
    } else {
      c[i] = c[i - 1] + 1;
      b[i] = b[i - 1];
    }
  }
  b[n + 1] = c[n + 1] = inf;
  for (int i = 1; i <= n; i++) {
    pos = 1;
    A = B = 0;
    while (pos <= n) {
      int l = pos, r = n + 2, L = pos, R = n + 2;
      while (l < r) {
        int m = (l + r) / 2;
        if (b[m] - b[pos - 1] >= i)
          r = m;
        else
          l = m + 1;
      }
      while (L < R) {
        int m = (L + R) / 2;
        if (c[m] - c[pos - 1] >= i)
          R = m;
        else
          L = m + 1;
      }
      int x = l;
      int y = L;
      if (x == n + 1 && y == n + 1) goto Q;
      if (x < y) {
        pos = x + 1;
        A++;
      } else {
        pos = y + 1;
        B++;
      }
    }
    if (B < A)
      if (a[n] == 1) p[++cnt] = make_pair(A, i);
    if (A < B)
      if (a[n] == 2) p[++cnt] = make_pair(B, i);
  Q:;
  }
  cout << cnt << endl;
  ;
  sort(p + 1, p + 1 + cnt);
  for (int i = 1; i <= cnt; i++)
    cout << p[i].first << " " << p[i].second << endl;
  return 0;
}
