#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, a[100005];
int cnt[2][100005];
using pii = pair<int, int>;
bool cmp(pii x, pii y) {
  if (x.second != y.second) return x.second < y.second;
  return x.first < y.first;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i]--;
    cnt[0][i] = cnt[0][i - 1] + (a[i] == 0);
    cnt[1][i] = cnt[1][i - 1] + (a[i] == 1);
  }
  int mx = max(cnt[0][n], cnt[1][n]);
  vector<pii> V;
  for (int t = 1; t <= mx; t++) {
    int pos = 0;
    bool flag = 0;
    int g[2] = {0, 0};
    while (pos < n) {
      if (cnt[0][n] - cnt[0][pos] < t && cnt[1][n] - cnt[1][pos] < t) {
        flag = 1;
        break;
      }
      int ps[2] = {n + 10, n + 10};
      for (int i = 0; i < 2; i++)
        ps[i] = lower_bound(cnt[i], cnt[i] + n + 1, cnt[i][pos] + t) - cnt[i];
      pos = min(ps[0], ps[1]);
      assert(ps[0] != ps[1]);
      if (ps[0] < ps[1])
        g[0]++;
      else
        g[1]++;
    }
    if (!flag) {
      if (g[0] > g[1] && a[n] == 0) {
        V.emplace_back(t, g[0]);
      }
      if (g[1] > g[0] && a[n] == 1) {
        V.emplace_back(t, g[1]);
      }
    }
  }
  int sz = V.size();
  sort(V.begin(), V.end(), cmp);
  printf("%d\n", sz);
  for (int i = 0; i < sz; i++) printf("%d %d\n", V[i].second, V[i].first);
  return 0;
}
