#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  set<pair<int, int> > ans;
  cin >> n;
  vector<int> game(n);
  vector<vector<int> > pre(2, vector<int>(n, 0));
  for (int i = 0; i < n; ++i) {
    cin >> game[i];
    game[i]--;
  }
  pre[game[0]][0] = 1;
  for (int i = 1; i < n; ++i) {
    pre[0][i] = pre[0][i - 1];
    pre[1][i] = pre[1][i - 1];
    pre[game[i]][i]++;
  }
  for (int s = 1; s <= n; ++s) {
    int set0 = 0, set1 = 0;
    bool poss = 0;
    bool perf = 0;
    int pre0 = 0, pre1 = 0;
    int i = 0;
    while (i < n) {
      int n0, n1;
      n0 = lower_bound(pre[0].begin(), pre[0].end(), pre0 + s) - pre[0].begin();
      n1 = lower_bound(pre[1].begin(), pre[1].end(), pre1 + s) - pre[1].begin();
      if (n0 < n && n1 < n) assert(n0 != n1);
      int next = min(n0, n1);
      if (next == n - 1) perf = 1;
      if (next < n) {
        pre0 = pre[0][next];
        pre1 = pre[1][next];
        if (n0 < n1) {
          if (set0 >= set1)
            poss = 1;
          else
            poss = 0;
          set0++;
        } else {
          if (set1 >= set0)
            poss = 1;
          else
            poss = 0;
          set1++;
        }
      }
      i = next + 1;
    }
    if (poss && perf) {
      ans.insert(make_pair(max(set1, set0), s));
    }
  }
  cout << ans.size() << endl;
  for (set<pair<int, int> >::iterator it = ans.begin(); it != ans.end(); it++) {
    cout << (*it).first << " " << (*it).second << endl;
  }
  return 0;
}
