#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > sum;
vector<int> arr;
int n;
bool check(int coef, int sp, int t, int player) {
  int total = sum[sp + coef][player] - sum[sp - 1][player];
  return total >= t;
}
int binarySearch(int sp, int t, int player) {
  int L = 0, R = n - sp;
  while (L + 1 < R) {
    int M = (L + R) / 2;
    if (check(M, sp, t, player))
      R = M;
    else
      L = M;
  }
  if (check(L, sp, t, player)) return L;
  if (check(R, sp, t, player)) return R;
  return -1;
}
int main() {
  vector<pair<int, int> > answer;
  scanf("%d", &n);
  arr.resize(n + 1, 0);
  sum.resize(n + 1, vector<int>(2, 0));
  vector<int> next(n + 1, -1);
  for (int i = 1; i < n + 1; i++) scanf("%d", &arr[i]);
  for (int i = 1; i < n + 1; i++) {
    --arr[i];
    sum[i][0] = sum[i - 1][0] + !arr[i];
    sum[i][1] = sum[i - 1][1] + arr[i];
  }
  int winner = arr[n];
  for (int t = 1; t <= n; t++) {
    int win[2] = {0, 0};
    int sp = 1;
    bool valid = true;
    while (sp <= n) {
      int pos[2];
      pos[0] = binarySearch(sp, t, 0);
      pos[1] = binarySearch(sp, t, 1);
      if (pos[0] != -1) pos[0] = sp + pos[0];
      if (pos[1] != -1) pos[1] = sp + pos[1];
      if (pos[0] == -1 || pos[1] == -1) {
        if (pos[0] == -1 && pos[1] == -1) break;
        if (pos[0] == -1) {
          ++win[1];
          sp = pos[1] + 1;
        } else {
          ++win[0];
          sp = pos[0] + 1;
        }
      } else {
        assert(pos[0] != pos[1]);
        if (pos[0] < pos[1]) {
          ++win[0];
          sp = pos[0] + 1;
        } else {
          ++win[1];
          sp = pos[1] + 1;
        }
      }
    }
    if (sp != n + 1) valid = false;
    if (win[winner] <= win[!winner]) valid = false;
    if (valid) answer.push_back(pair<int, int>(win[winner], t));
  }
  printf("%d\n", (int)answer.size());
  sort(answer.begin(), answer.end());
  answer.erase(unique(answer.begin(), answer.end()), answer.end());
  for (int i = 0; i < (int)answer.size(); i++)
    printf("%d %d\n", answer[i].first, answer[i].second);
  return 0;
}
