#include <bits/stdc++.h>
using namespace std;
int N, T, A[100005], F[2][100005];
struct Nod {
  int x, y;
} Ans[100005];
inline int Next(int st, int len) {
  if (F[0][N] - F[0][st - 1] < len && F[1][N] - F[1][st - 1] < len) return -1;
  int l = st - 1, r = N;
  for (; l + 1 < r;) {
    int Mid = l + r >> 1;
    if (F[0][Mid] - F[0][st - 1] >= len || F[1][Mid] - F[1][st - 1] >= len)
      r = Mid;
    else
      l = Mid;
  }
  return r;
}
inline void Work(int b) {
  int x = 0, y = 0;
  for (int i = 1, j; i <= N; i = j + 1) {
    if ((j = Next(i, b)) == -1) return;
    if (F[0][j] - F[0][i - 1] >= b) x++;
    if (F[1][j] - F[1][i - 1] >= b) y++;
  }
  if (x == y) return;
  if (x > y && A[N] == 2 || x < y && A[N] == 1) return;
  T++;
  Ans[T].x = max(x, y);
  Ans[T].y = b;
}
inline bool Cmp(Nod a, Nod b) { return a.x < b.x || a.x == b.x && a.y < b.y; }
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    int x;
    scanf("%d", &A[i]);
    F[0][i] = F[0][i - 1] + (A[i] == 1);
    F[1][i] = F[1][i - 1] + (A[i] == 2);
  }
  for (int i = 1; i <= N; i++) Work(i);
  printf("%d\n", T);
  sort(Ans + 1, Ans + T + 1, Cmp);
  for (int i = 1; i <= T; i++) printf("%d %d\n", Ans[i].x, Ans[i].y);
}
