#include <bits/stdc++.h>
using namespace std;
int J1[100005], J2[100005], n, d;
int findS(int t) {
  int pos1 = 0, pos2 = 0, s1 = 0, s2 = 0;
  while (pos1 < J1[n] || pos2 < J2[n]) {
    int p1 = lower_bound(J1, J1 + n + 1, pos1 + t) - J1;
    int p2 = lower_bound(J2, J2 + n + 1, pos2 + t) - J2;
    if (p1 > n && p2 > n) return -1;
    if (p1 < p2) {
      p2 = p1;
      s1++;
    } else {
      p1 = p2;
      s2++;
    }
    if (p1 == n && p2 == n) {
      if (s1 > s2 && d == 1 || s1 < s2 && d == 2) return max(s1, s2);
      break;
    } else {
      pos1 = J1[p1];
      pos2 = J2[p2];
    }
  }
  return -1;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> d;
    if (d == 1)
      J1[i] = 1;
    else
      J2[i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    J1[i] += J1[i - 1];
    J2[i] += J2[i - 1];
  }
  vector<pair<int, int> > res;
  for (int t = 1; t <= n; t++) {
    int s = findS(t);
    if (s > 0) res.push_back(make_pair(s, t));
  }
  sort(res.begin(), res.end());
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); i++)
    cout << res[i].first << " " << res[i].second << endl;
  return 0;
}
