#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200 * 1001;
int a[MAXN];
int ind[2][MAXN];
int sum[2][MAXN];
vector<pair<int, int> > ans;
int n;
int _sum(int k, int a, int b) {
  return sum[k][b] - ((a == 0) ? 0 : sum[k][a - 1]);
}
void check(int k) {
  int ch[2] = {0, 0};
  int cnt[2] = {0, 0};
  int pos = 0;
  int la = 0;
  while (pos < n) {
    int ind0 = ind[0][cnt[0] + k];
    int ind1 = ind[1][cnt[1] + k];
    if (ind0 == ind1 && ind0 == n) return;
    if (ind0 > ind1) {
      la = 1;
      ch[1]++;
      cnt[1] += k;
      cnt[0] += _sum(0, pos, ind1);
    } else {
      la = 0;
      ch[0]++;
      cnt[0] += k;
      cnt[1] += _sum(1, pos, ind0);
    }
    pos = min(ind0, ind1) + 1;
  }
  int l_ans = max(ch[0], ch[1]);
  ch[la]--;
  if (l_ans != max(ch[0], ch[1])) ans.push_back(make_pair(l_ans, k));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], a[i]--;
  for (int j = 0; j < 2; j++) {
    int cnt = 1;
    for (int i = 0; i < n; i++)
      if (a[i] == j) ind[j][cnt++] = i;
    for (int i = cnt; i < MAXN; i++) ind[j][i] = n;
    sum[j][0] = (a[0] == j) ? 1 : 0;
    for (int i = 1; i < n; i++)
      if (a[i] == j)
        sum[j][i] = sum[j][i - 1] + 1;
      else
        sum[j][i] = sum[j][i - 1];
  }
  for (int i = 1; i <= n; i++) check(i);
  cout << ans.size() << "\n";
  sort(ans.begin(), ans.end());
  for (int i = 0; i < (int)ans.size(); i++)
    cout << ans[i].first << " " << ans[i].second << '\n';
  return 0;
}
