#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int n, f[maxn][3];
pair<int, int> ans[maxn];
int get_pos(int pos, int k, int c) {
  int l = pos + 1, r = n, m;
  if (f[n][c] - f[pos][c] < k) return 0x3f3f3f3f;
  while (l < r) {
    m = (l + r) >> 1;
    if (f[m][c] - f[pos][c] < k)
      l = m + 1;
    else
      r = m;
  }
  return l;
}
int get_ans(int k) {
  int pos = 0, pos1 = 0, pos2 = 0, win1 = 0, win2 = 0, last;
  while (true) {
    pos1 = get_pos(pos, k, 1);
    pos2 = get_pos(pos, k, 2);
    if (pos1 > n && pos2 > n) return -1;
    if (pos1 < pos2) {
      pos = pos1;
      last = 1;
      win1++;
    } else if (pos1 > pos2) {
      pos = pos2;
      last = 2;
      win2++;
    }
    if (pos == n) {
      if (last == 1 && win1 <= win2) return -1;
      if (last == 2 && win2 <= win1) return -1;
      return max(win1, win2);
    }
  }
}
int main() {
  cin >> n;
  int i, tmp;
  memset(f, 0, sizeof(f));
  for (int i = 1; i <= n; i++) {
    cin >> tmp;
    f[i][tmp] = 1;
  }
  for (i = 1; i <= n; i++) {
    f[i][1] += f[i - 1][1];
    f[i][2] += f[i - 1][2];
  }
  int cnt = 0;
  for (i = 1; i <= n; i++) {
    int res = get_ans(i);
    if (res != -1) ans[cnt++] = make_pair(res, i);
  }
  sort(ans, ans + cnt);
  cout << cnt << endl;
  for (i = 0; i < cnt; i++)
    cout << ans[i].first << " " << ans[i].second << endl;
  return 0;
}
