#include <bits/stdc++.h>
using namespace std;
int n, t, s1[200005], s2[200005], pn, a[200005];
pair<int, int> p[5000005];
bool ok(int l, int r) {
  if (s2[r] - s2[l - 1] >= t) return 1;
  if (s1[r] - s1[l - 1] >= t) return 1;
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    s1[i] = s1[i - 1];
    s2[i] = s2[i - 1];
    if (a[i] == 1)
      s1[i]++;
    else
      s2[i]++;
  }
  for (t = 1; t <= n; ++t) {
    int v = 1, pos, last, p1 = 0, p2 = 0;
    while (v <= n) {
      int l = v, r = n;
      while (r - l > 1) {
        int mid = (r + l) >> 1;
        if (ok(v, mid))
          r = mid;
        else
          l = mid;
      }
      if (ok(v, l))
        pos = l;
      else if (ok(v, r))
        pos = r;
      else
        break;
      if (s2[pos] - s2[v - 1] == t) {
        p2++;
        last = 2;
      } else {
        last = 1;
        p1++;
      }
      v = pos + 1;
    }
    if (v == n + 1) {
      if (a[n] == 1) {
        if (last == 1 && p1 > p2) p[pn++] = make_pair(p1, t);
      } else {
        if (last == 2 && p2 > p1) p[pn++] = make_pair(p2, t);
      }
    }
  }
  sort(p, p + pn);
  printf("%d\n", pn);
  for (int i = 0; i < pn; ++i) printf("%d %d\n", p[i].first, p[i].second);
  return 0;
}
