#include <bits/stdc++.h>
using namespace std;
const int MAX = 120000;
vector<pair<int, int> > ans;
int a[200000];
int s[2][200000];
int n;
pair<int, int> bp(int pos, int len, pair<int, int> prev) {
  int l = pos, r = n - 1;
  while (l != r) {
    int x = (l + r) / 2;
    if (s[0][x] - prev.first >= len || s[1][x] - prev.second >= len)
      r = x;
    else
      l = x + 1;
  }
  if (s[0][l] - prev.first >= len) return make_pair(0, l);
  if (s[1][l] - prev.second >= len) return make_pair(1, l);
  return make_pair(-1, -1);
}
int main() {
  cin >> n;
  for (int(i) = (0); i < (n); ++(i)) {
    cin >> a[i];
    a[i]--;
  }
  for (int(i) = (0); i < (n); ++(i)) {
    if (i) s[0][i] = s[0][i - 1], s[1][i] = s[1][i - 1];
    s[a[i]][i]++;
  }
  for (int(len) = (1); len < (n + 1); ++(len)) {
    int q[2] = {0};
    bool ok = 1;
    int pos = 0;
    pair<int, int> prev = make_pair(0, 0);
    int last = a[n - 1];
    while (pos != n) {
      pair<int, int> nxt = bp(pos, len, prev);
      if (nxt.first == -1) {
        ok = 0;
        break;
      }
      q[nxt.first]++;
      prev = make_pair(s[0][nxt.second], s[1][nxt.second]);
      pos = nxt.second + 1;
    }
    if (q[last] <= q[last ^ 1]) ok = 0;
    if (ok) ans.push_back(make_pair(q[last], len));
  }
  cout << ans.size() << endl;
  sort(ans.begin(), ans.end());
  for (int(i) = (0); i < (ans.size()); ++(i))
    cout << ans[i].first << " " << ans[i].second << endl;
  return 0;
}
