#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
struct Node {
  int s, t;
  Node() {}
  Node(int s, int t) : s(s), t(t) {}
  bool operator<(const Node& a) const {
    if (s != a.s) return s < a.s;
    return t < a.t;
  }
};
Node ans[MAXN];
int top;
int fac[MAXN], cnt;
int a[MAXN];
int x[MAXN], y[MAXN];
int n;
int search(int x, int a[], int l = 1, int r = n) {
  while (l < r) {
    int m = (l + r) >> 1;
    if (a[m] >= x)
      r = m;
    else
      l = m + 1;
  }
  return l;
}
void solve() {
  int sum1 = 0;
  int sum2 = 0;
  top = 0;
  memset(x, 0, sizeof x);
  memset(y, 0, sizeof y);
  for (int i = (1); i <= (n); ++i) {
    scanf("%d", &a[i]);
    if (a[i] == 1)
      sum1++, x[i] = 1;
    else
      sum2++, y[i] = 1;
  }
  for (int i = (1); i <= (n); ++i) x[i] += x[i - 1], y[i] += y[i - 1];
  for (int o = (1); o <= (n); ++o) {
    int t = o;
    int win1 = 0, win2 = 0;
    int tmp1 = 0, tmp2 = 0;
    while (1) {
      int X = search(x[tmp1] + t, x);
      int Y = search(y[tmp2] + t, y);
      if (x[X] != x[tmp1] + t && y[Y] != y[tmp2] + t) break;
      if (x[X] == x[tmp1] + t && y[Y] != y[tmp2] + t) {
        ++win1;
        tmp1 = tmp2 = X;
      } else if (x[X] != x[tmp1] + t && y[Y] == y[tmp2] + t) {
        ++win2;
        tmp1 = tmp2 = Y;
      } else {
        if (X < Y) {
          ++win1;
          tmp1 = tmp2 = X;
        } else {
          ++win2;
          tmp1 = tmp2 = Y;
        }
      }
    }
    if (win1 > win2 && search(x[tmp1], x) == n) {
      ans[top++] = Node(win1, t);
    } else if (win1 < win2 && search(y[tmp2], y) == n) {
      ans[top++] = Node(win2, t);
    }
  }
  sort(ans, ans + top);
  printf("%d\n", top);
  for (int i = (0); i < (top); ++i) printf("%d %d\n", ans[i].s, ans[i].t);
}
int main() {
  while (~scanf("%d", &n)) solve();
  return 0;
}
