#include <bits/stdc++.h>
using namespace std;
int a[100005], s[100005], s2[100005];
vector<pair<int, int> > V;
int main() {
  int i, n, get[3], h, sel, pos, pos1, pos2;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    s[i] = s[i - 1] + (a[i] == 1);
    s2[i] = s2[i - 1] + (a[i] == 2);
  }
  for (i = 1; i <= n; ++i) {
    h = 0;
    get[1] = get[2] = 0;
    while (true) {
      pos1 = lower_bound(s + h + 1, s + n + 1, s[h] + i) - s;
      pos2 = lower_bound(s2 + h + 1, s2 + n + 1, s2[h] + i) - s2;
      if (pos1 < pos2) {
        sel = 1;
        pos = pos1;
      } else {
        sel = 2;
        pos = pos2;
      }
      if (pos > n) break;
      get[sel] += 1;
      h = pos;
      if (pos == n && get[sel] > get[3 - sel]) {
        V.push_back(make_pair(get[sel], i));
      }
    }
  }
  sort(V.begin(), V.end());
  printf("%d\n", (int)V.size());
  for (i = 0; i < (int)V.size(); ++i)
    printf("%d %d\n", V[i].first, V[i].second);
  return 0;
}
