#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433832795l;
const long long mod = 1000000007;
int a[100100], b[100100];
pair<int, int> ans[100100];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < int(n); ++i) {
    if (i) {
      a[i] = a[i - 1];
      b[i] = b[i - 1];
    }
    int x;
    scanf("%d", &x);
    if (x == 1) {
      ++a[i];
    } else {
      ++b[i];
    }
  }
  int sz = 0;
  for (int x = 1; x <= n; ++x) {
    int y1 = 0, y2 = 0, cur = -1, cura = 0, curb = 0;
    bool ok = true;
    while (cur < n - 1) {
      int c1 = lower_bound(a, a + n, cura + x) - a;
      int c2 = lower_bound(b, b + n, curb + x) - b;
      ok = true;
      if (c1 < c2) {
        ++y1;
        cur = c1;
        if (y1 <= y2) {
          ok = false;
        }
      } else {
        ++y2;
        cur = c2;
        if (y2 <= y1) {
          ok = false;
        }
      }
      cura = a[cur];
      curb = b[cur];
    }
    if (cur == n - 1 && ok) {
      ans[sz++] = make_pair(max(y1, y2), x);
    }
  }
  printf("%d\n", sz);
  sort(ans, ans + sz);
  for (int i = 0; i < int(sz); ++i) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
