#include <bits/stdc++.h>
using namespace std;
vector<int> fr, sc;
int ans_fr, ans_sc;
vector<pair<int, int> > ans;
bool is_pos(int dif) {
  vector<int>::iterator fr_pt, sc_pt;
  fr_pt = fr.begin();
  sc_pt = sc.begin();
  int fir, sec;
  while (true) {
    if (fr_pt + dif > fr.end() && sc_pt + dif > sc.end()) break;
    if (fr_pt + dif > fr.end())
      fir = 1000000000;
    else
      fir = *(fr_pt + dif - 1);
    if (sc_pt + dif > sc.end())
      sec = 1000000000;
    else
      sec = *(sc_pt + dif - 1);
    if (fir < sec) {
      ans_fr++;
      sc_pt = upper_bound(sc.begin(), sc.end(), fir);
      fr_pt += dif;
    } else {
      ans_sc++;
      fr_pt = upper_bound(fr.begin(), fr.end(), sec);
      sc_pt += dif;
    }
  }
  if (fr_pt == fr.end() && sc_pt == sc.end() && ans_fr > ans_sc) return true;
  return false;
}
int main() {
  int n, i;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    if (x == 1)
      fr.push_back(i);
    else
      sc.push_back(i);
    if (i == n - 1 && x == 2) swap(fr, sc);
  }
  ans_fr = ans_sc = 1;
  for (i = 1; i <= n; i++) {
    ans_fr = ans_sc = 0;
    if (is_pos(i)) {
      ans.push_back({max(ans_fr, ans_sc), i});
    }
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (i = 0; i < ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
