#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
const int N = 500100;
int A[N];
int B[N];
int score[N][3];
int main() {
  for (int i = 0; i < N; i++) {
    A[i] = INF;
    B[i] = INF;
  }
  int n;
  cin >> n;
  int ena = 0;
  int dva = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      ena++;
      A[ena] = i;
    } else {
      dva++;
      B[dva] = i;
    }
    score[i][1] = ena;
    score[i][2] = dva;
  }
  vector<pair<int, int> > results;
  for (int t = 1; t <= n; t++) {
    int f = 0;
    int s = 0;
    int sco[3];
    sco[1] = 0;
    sco[2] = 0;
    while (true) {
      if (A[f + t] < B[s + t]) {
        sco[1]++;
      } else {
        sco[2]++;
      }
      int p = min(A[f + t], B[s + t]);
      if (p == INF) break;
      if (p == n) {
        if (A[f + t] < B[s + t] && sco[1] > sco[2]) {
          results.push_back(make_pair(sco[1], t));
        } else if (A[f + t] > B[s + t] && sco[1] < sco[2]) {
          results.push_back(make_pair(sco[2], t));
        }
      }
      f = score[p][1];
      s = score[p][2];
    }
  }
  sort(results.begin(), results.end());
  int d = results.size();
  cout << d << endl;
  for (int i = 0; i < d; i++)
    cout << (results[i].first) << " " << (results[i].second) << endl;
  return 0;
}
