#include <bits/stdc++.h>
using namespace std;
long n;
long ar[1 << 20];
long ttl[10];
long y;
long pt[10];
vector<pair<long, long> > ans;
long s[1 << 20][3];
void check(long x) {
  long set[10];
  set[1] = set[2] = 0;
  long qp = 0;
  long win = 0;
  while (true) {
    long l, r;
    long mid;
    l = qp + 1;
    r = n + 1;
    while (l < r) {
      mid = l + r;
      mid /= 2;
      if (s[mid][1] - s[qp][1] < x && s[mid][2] - s[qp][2] < x)
        l = mid + 1;
      else
        r = mid;
    }
    if (l > n) return;
    if (s[l][1] - s[qp][1] == x)
      win = 1, set[1]++;
    else
      win = 0, set[2]++;
    qp = l;
    if (qp == n) break;
  }
  if (set[1] > set[2] && win == 1) ans.push_back(make_pair(set[1], x));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  if (ar[n] == 2)
    for (int i = 1; i <= n; i++) ar[i] = 3 - ar[i];
  for (int i = 1; i <= n; i++)
    s[i][1] = s[i - 1][1] + (ar[i] == 1), s[i][2] = s[i - 1][2] + (ar[i] == 2);
  for (int i = 1; i <= 100000; i++) {
    check(i);
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first << " " << ans[i].second << endl;
  cin.get();
  cin.get();
  return 0;
}
