#include <bits/stdc++.h>
using namespace std;
const int SZ = 1000010, INF = 0x7FFFFFFF;
const double EPS = 1e-9;
int psum[3][SZ];
int main() {
  vector<pair<int, int>> res;
  int n;
  scanf("%d", &n);
  vector<int> vct(n + 1);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &vct[i]);
  }
  psum[1][1] = vct[1] == 1;
  psum[2][1] = vct[1] == 2;
  for (int i = 2; i <= n; ++i) {
    psum[1][i] = (vct[i] == 1) + (psum[1][i - 1]);
    psum[2][i] = (vct[i] == 2) + (psum[2][i - 1]);
  }
  for (int i = 1; i <= n; ++i) {
    int cur = 1;
    bool fail = 0;
    int win1 = 0, win2 = 0, last = 0;
    for (; cur <= n;) {
      int lo = cur, hi = n + 1;
      int pos1, pos2;
      pos1 = lower_bound(psum[1] + 1, psum[1] + n + 1, psum[1][cur - 1] + i) -
             (psum[1]);
      pos2 = lower_bound(psum[2] + 1, psum[2] + n + 1, psum[2][cur - 1] + i) -
             (psum[2]);
      if (pos1 < pos2)
        ++win1;
      else
        ++win2;
      last = (pos1 < pos2 ? 1 : 2);
      if (pos1 == pos2) {
        fail = 1;
        break;
      }
      cur = min(pos1, pos2) + 1;
    }
    if (win1 == win2) fail = 1;
    if (win1 > win2 && last != 1) fail = 1;
    if (win2 > win1 && last != 2) fail = 1;
    if (!fail) {
      res.push_back(make_pair(max(win1, win2), i));
    }
  }
  sort(res.begin(), res.end());
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); ++i) {
    printf("%d %d\n", res[i].first, res[i].second);
  }
  return 0;
}
