#include <bits/stdc++.h>
using namespace std;
int res;
int a[100020], sum[3][100020];
struct point {
  int a, b;
} b[100020];
int cmp(point x, point y) {
  return (x.b < y.b) || ((x.b == y.b) && (x.a < y.a));
}
int main() {
  int n;
  cin >> n;
  for (int i = 1, _b = n; i <= _b; i++) cin >> a[i];
  for (int i = 1, _b = n; i <= _b; i++) {
    sum[1][i] = sum[1][i - 1] + (a[i] == 1);
    sum[2][i] = sum[2][i - 1] + (a[i] == 2);
  }
  int fi, pos1, pos2, dem1, dem2, prev, cur;
  for (int t = 1, _b = n; t <= _b; t++) {
    fi = 0;
    dem1 = 0;
    dem2 = 0;
    while (fi <= n) {
      prev = fi;
      pos1 =
          lower_bound(sum[1] + fi + 1, sum[1] + n + 1, t + sum[1][fi]) - sum[1];
      pos2 =
          lower_bound(sum[2] + fi + 1, sum[2] + n + 1, t + sum[2][fi]) - sum[2];
      fi = min(pos1, pos2);
      if ((pos1 == fi) && (fi <= n)) {
        dem1++;
        cur = 1;
      }
      if ((pos2 == fi) && (fi <= n)) {
        dem2++;
        cur = 2;
      }
    }
    if ((prev == n) && (dem1 != dem2) &&
        ((dem1 > dem2 && cur == 1) || (dem2 > dem1 && cur == 2))) {
      res++;
      b[res].a = t;
      b[res].b = max(dem1, dem2);
    }
  }
  cout << res << endl;
  sort(b + 1, b + res + 1, cmp);
  for (int i = 1, _b = res; i <= _b; i++)
    cout << b[i].b << ' ' << b[i].a << endl;
}
