#include <bits/stdc++.h>
using namespace std;
int ones[100000];
int oneCnt;
int twos[100000];
int twoCnt;
int N;
int main() {
  vector<pair<int, int>> res;
  cin >> N;
  oneCnt = 0;
  twoCnt = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (a == 1) {
      ones[oneCnt] = i;
      oneCnt++;
    } else {
      twos[twoCnt] = i;
      twoCnt++;
    }
  }
  for (int t = 1; t <= N; t++) {
    int index = 0;
    int s1 = 0, s2 = 0;
    int last = 0;
    while (index < N) {
      int pOne = lower_bound(ones, ones + oneCnt, index) - ones;
      int pTwo = lower_bound(twos, twos + twoCnt, index) - twos;
      bool ok = false;
      if (pOne + t - 1 < oneCnt) {
        if (pTwo + t - 1 >= twoCnt ||
            (twos[pTwo + t - 1] > ones[pOne + t - 1])) {
          s1++;
          last = s1;
          index = ones[pOne + t - 1] + 1;
          ok = true;
        }
      }
      if (!ok && pTwo + t - 1 < twoCnt) {
        if (pOne + t - 1 >= oneCnt ||
            (ones[pOne + t - 1] > twos[pTwo + t - 1])) {
          s2++;
          last = s2;
          index = twos[pTwo + t - 1] + 1;
          ok = true;
        }
      }
      if (!ok) {
        s1 = -1;
        break;
      }
    }
    if (s1 != -1 && s1 != s2 && max(s1, s2) == last) {
      res.push_back(make_pair(max(s1, s2), t));
    }
  }
  sort(res.begin(), res.end());
  cout << res.size() << "\n";
  for (int i = 0; i < res.size(); i++) {
    cout << res[i].first << " " << res[i].second << "\n";
  }
  return 0;
}
