#include <bits/stdc++.h>
using namespace std;
int a[100001], howmany[2][100001];
int n, score[2], cnt[2];
vector<pair<int, int> > ans;
vector<int> frst, scnd;
int main() {
  ios_base::sync_with_stdio(0);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  if (a[n - 1] == 2)
    for (int i = 0; i < n; i++) a[i] = 3 - a[i];
  for (int i = 0; i < n; i++) a[i]--;
  int s = 0;
  for (int i = 0; i < n; i++)
    if (a[i] == 0) s++;
  int other = n - s;
  int half = s / 2;
  frst.push_back(0);
  scnd.push_back(0);
  for (int i = 0; i < n; i++)
    if (a[i] == 0)
      frst.push_back(i);
    else
      scnd.push_back(i);
  for (int i = 0; i < n; i++) frst.push_back(1000000), scnd.push_back(1000000);
  for (int i = 0; i < n; i++) {
    howmany[0][i] = howmany[0][i - 1];
    howmany[1][i] = howmany[1][i - 1];
    howmany[a[i]][i]++;
  }
  int fs, sc, pos;
  for (int i = 1; i <= half; i++) {
    fs = sc = pos = score[0] = score[1] = 0;
    if (i > other) {
      if (s % i == 0) ans.push_back(make_pair(s / i, i));
      continue;
    }
    while (pos < n - 1)
      if (frst[fs + i] < scnd[sc + i]) {
        pos = frst[fs + i];
        if (pos == 1000000) continue;
        fs = howmany[0][pos];
        sc = howmany[1][pos];
        score[0]++;
      } else {
        pos = scnd[sc + i];
        if (pos == 1000000) continue;
        fs = howmany[0][pos];
        sc = howmany[1][pos];
        score[1]++;
      }
    if (pos == n - 1 && score[0] > score[1])
      ans.push_back(make_pair(score[0], i));
  }
  if (s > n - s) ans.push_back(make_pair(1, s));
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
