#include <bits/stdc++.h>
using namespace std;
const int sz = 1e5 + 9;
int n;
int a[sz];
int cs[3][sz];
vector<pair<int, int>> ans;
int w = 1, l = 2;
int ns[3][sz], nt[3][sz];
int lost[3];
int nxt[3][sz];
int idx[sz];
int sec[3][sz];
bool ok(int s, int t) {
  lost[1] = lost[2] = 0;
  if (idx[t])
    return ((ns[1][t] == s && ns[2][t] < s && sec[1][t] == n) ||
            (ns[2][t] == s && ns[1][t] < s && sec[2][t] == n)) &&
           idx[t] == n + 1;
  ns[1][t] = ns[2][t] = 0;
  idx[t] = 1;
  while (idx[t] <= n) {
    int nxtw = nxt[w][lost[w] + t];
    int nxtl = nxt[l][lost[l] + t];
    if (nxtw < nxtl) {
      idx[t] = nxtw + 1;
      ns[w][t]++;
      sec[w][t] = nxtw;
      lost[l] = cs[l][nxtw];
      lost[w] = cs[w][nxtw];
    } else if (nxtl < nxtw) {
      idx[t] = nxtl + 1;
      ns[l][t]++;
      sec[l][t] = nxtl;
      lost[l] = cs[l][nxtl];
      lost[w] = cs[w][nxtl];
    } else
      break;
  }
  return ((ns[1][t] == s && ns[2][t] < s && sec[1][t] == n) ||
          (ns[2][t] == s && ns[1][t] < s && sec[2][t] == n)) &&
         idx[t] == n + 1;
  ;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    cs[1][i] = cs[1][i - 1] + (a[i] == 1);
    cs[2][i] = cs[2][i - 1] + (a[i] == 2);
  }
  if (cs[1][n] == cs[2][n]) {
    printf("0");
    return 0;
  }
  for (int i = 1; i <= 3 * n; i++) nxt[1][i] = nxt[2][i] = 1e6;
  nxt[w][cs[w][1]] = 1;
  nxt[l][cs[l][1]] = 1;
  for (int i = 2; i <= n; i++) {
    if (cs[w][i] != cs[w][i - 1]) nxt[w][cs[w][i]] = i;
    if (cs[l][i] != cs[l][i - 1]) nxt[l][cs[l][i]] = i;
  }
  for (long long s = 1; s <= n; s++) {
    long long fst = ceil((n + s * 2 - 1) / (s * 4 - 2));
    long long lst = n / s;
    if (!fst) fst++;
    for (long long t = fst; t <= lst; t++) {
      if (ok(s, t)) ans.push_back(make_pair(s, t));
    }
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (auto u : ans) printf("%d %d\n", u.first, u.second);
  return 0;
}
