#include <bits/stdc++.h>
using namespace std;
int n, atotal, btotal, a[300003], ac, bc, as, bs, lwina, lwinb;
vector<pair<int, int>> ans;
int awinxpos[300003], bwinxpos[300003], aps[300003], bps[300003];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", i + a);
    (a[i] == 1 ? awinxpos[++atotal] : bwinxpos[++btotal]) = i;
    aps[i] = atotal;
    bps[i] = btotal;
  }
  int b = max(atotal, n - atotal);
  const auto try_t = [&](int t) {
    as = bs = ac = bc = 0;
    int i = 0;
    for (; ac + t <= atotal || bc + t <= btotal;) {
      if (ac + t > atotal) {
        lwinb = i = bwinxpos[bc += t], ++bs;
        continue;
      }
      if (bc + t > btotal) {
        lwina = i = awinxpos[ac += t], ++as;
        continue;
      }
      if (awinxpos[ac + t] < bwinxpos[bc + t]) {
        i = lwina = awinxpos[ac + t];
        ++as;
      } else {
        i = lwinb = bwinxpos[bc + t];
        ++bs;
      }
      ac = aps[i];
      bc = bps[i];
    }
    if (i != n - 1 || as == bs || as > bs && lwina != n - 1 ||
        as < bs && lwinb != n - 1)
      return;
    ans.emplace_back(max(as, bs), t);
  };
  for (int t = 1; t <= b; ++t) {
    try_t(t);
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (auto&& x : ans) printf("%d %d\n", x.first, x.second);
}
