#include <bits/stdc++.h>
using namespace std;
int const inf = 1e9;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> win(n);
  for (int i = 0; i < n; ++i) scanf("%d", &win[i]);
  vector<vector<int>> pos = {vector<int>(n + 1, inf), vector<int>(n + 1, inf)};
  vector<vector<int>> sum = {vector<int>(n + 1), vector<int>(n + 1)};
  for (int i = 1; i <= n; ++i) {
    sum[0][i] = sum[0][i - 1];
    sum[1][i] = sum[1][i - 1];
    int k = win[i - 1] - 1;
    sum[k][i] += 1;
    pos[k][sum[k][i]] = i;
  }
  vector<pair<int, int>> result;
  for (int t = 1; t <= n; ++t) {
    int s = 1;
    int i = 0;
    vector<int> ss = {0, 0};
    while (i < n) {
      int next0 = sum[0][i] + t > n ? inf : pos[0][sum[0][i] + t];
      int next1 = sum[1][i] + t > n ? inf : pos[1][sum[1][i] + t];
      if (next0 == inf && next1 == inf) {
        break;
      } else if (next0 < next1) {
        ss[0] += 1;
        i = next0;
      } else {
        assert(next0 > next1);
        ss[1] += 1;
        i = next1;
      }
      s += 1;
    }
    if (i == n && ss[win[n - 1] - 1] > ss[2 - win[n - 1]]) {
      result.push_back(make_pair(ss[win[n - 1] - 1], t));
    }
  }
  sort(begin(result), end(result));
  printf("%d\n", ((int)(result).size()));
  for (int i = 0; i < ((int)(result).size()); ++i)
    printf("%d %d\n", result[i].first, result[i].second);
  return 0;
}
