#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
  bool operator<(const node& p) const {
    if (y == p.y) return x < p.x;
    return y < p.y;
  }
};
vector<node> vc;
int dp1[1200000], dp2[1200000], big = 300000, ara[200000], vis[200000];
vector<int> per1, per2;
int process(int cnt, int i, int n, int game1, int game2) {
  int l, k, c, d, a, b, ac;
  if (i == n) return max(game1, game2);
  l = dp1[i + 1];
  k = dp2[i + 1];
  while (i <= n) {
    c = l + cnt - 1;
    d = k + cnt - 1;
    a = big, b = big;
    int sk = 0;
    if (c < per1.size()) {
      a = per1[c];
    }
    if (d < per2.size()) {
      b = per2[d];
    }
    if (a < b) {
      game1++;
      sk = 1;
    } else {
      game2++;
      sk = 2;
    }
    ac = min(a, b);
    if (ac >= big) return -1;
    if (ac == n) {
      if (game1 == game2) return -1;
      if (game1 > game2 && sk == 1) return game1;
      if (game2 > game1 && sk == 2) return game2;
      return -1;
    }
    l = dp1[ac + 1];
    k = dp2[ac + 1];
  }
  return -1;
}
int main() {
  int i, j, k, l, m, n, p1, p2;
  node gr;
  cin >> n;
  memset(dp1, -1, sizeof dp1);
  memset(dp2, -1, sizeof dp2);
  dp2[n + 1] = dp1[n + 1] = big;
  for (i = 1; i <= n; i++) {
    scanf("%d", &ara[i]);
    if (ara[i] == 1) {
      dp1[i] = per1.size();
      per1.push_back(i);
    } else {
      dp2[i] = per2.size();
      per2.push_back(i);
    }
  }
  for (i = n; i >= 1; i--) {
    if (dp1[i] == -1) dp1[i] = dp1[i + 1];
  }
  for (i = n; i >= 1; i--) {
    if (dp2[i] == -1) dp2[i] = dp2[i + 1];
  }
  int cnt = 0, cnt2 = 0;
  for (i = 1; i <= n; i++) {
    if (ara[i] == 1) cnt++;
    if (ara[i] == 2) cnt2++;
    int ck = -1;
    if (vis[cnt] == 0 && cnt) {
      ck = process(cnt, i, n, 1, 0);
      if (ck != -1) {
        gr.x = cnt;
        gr.y = ck;
        vc.push_back(gr);
      }
      vis[cnt] = 1;
    }
    if (vis[cnt2] == 0 && cnt2) {
      ck = process(cnt2, i, n, 0, 1);
      if (ck != -1) {
        gr.x = cnt2;
        gr.y = ck;
        vc.push_back(gr);
      }
      vis[cnt2] = 1;
    }
    vis[cnt] = 1;
    vis[cnt2] = 1;
  }
  sort(vc.begin(), vc.end());
  cout << vc.size() << endl;
  for (i = 0; i < vc.size(); i++) {
    cout << vc[i].y << " " << vc[i].x << endl;
  }
}
