#include <bits/stdc++.h>
using namespace std;
const int N = 200000;
int n;
int a[N];
int cnt[2];
int sets[2];
vector<int> pos[2];
int s[N][2];
set<pair<int, int> > ans;
int sum(int l, int r, int who) {
  return s[r][who] - (l > 0 ? s[l - 1][who] : 0);
}
void solve(int who) {
  for (int t = 1; t <= cnt[who]; t++) {
    int last = 0;
    sets[0] = sets[1] = 0;
    int temp = 0;
    for (int i = t - 1; i < pos[who].size();) {
      if (sum(last, pos[who][i], 1 - who) < t) {
        sets[who]++;
        if (i == pos[who].size() - 1 && sets[who] > sets[1 - who]) {
          ans.insert(make_pair(sets[who], t));
        }
        temp += sum(last, pos[who][i], 1 - who);
        last = pos[who][i] + 1;
        i += t;
      } else {
        sets[1 - who]++;
        temp += t;
        int j = pos[1 - who][temp - 1];
        i += sum(last, j, who);
        last = j + 1;
      }
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    a[i]--;
    cnt[a[i]]++;
    pos[a[i]].push_back(i);
    s[i][0] = (a[i] == 0) + (i > 0 ? s[i - 1][0] : 0);
    s[i][1] = (a[i] == 1) + (i > 0 ? s[i - 1][1] : 0);
  }
  solve(a[n - 1]);
  printf("%d\n", ans.size());
  for (set<pair<int, int> >::iterator it = ans.begin(); it != ans.end(); it++) {
    printf("%d %d\n", it->first, it->second);
  }
  return 0;
}
