#include <bits/stdc++.h>
using namespace std;
string s;
int n, a[200200], firs[200200][3], wins[200200][3];
vector<pair<int, int> > ans;
int main() {
  if (fopen("input.in", "r")) freopen("input.in", "r", stdin);
  cin >> n;
  for (int i = 1; i < 200200; i++) firs[i][1] = firs[i][2] = 1 << 20;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    wins[i][1] = wins[i - 1][1];
    wins[i][2] = wins[i - 1][2];
    wins[i][a[i]]++;
    firs[wins[i][a[i]]][a[i]] = i;
  }
  for (int t = 1; t <= n; t++) {
    int du[3];
    du[1] = du[2] = 0;
    bool works = 0;
    for (int j = 0; j <= n;) {
      if (j == n) {
        works = 1;
        break;
      }
      int idx1 = firs[wins[j][1] + t][1];
      int idx2 = firs[wins[j][2] + t][2];
      j = min(idx1, idx2);
      if (idx1 < idx2)
        du[1]++;
      else
        du[2]++;
    }
    if (works && du[a[n]] > du[1 + (a[n]) % 2])
      ans.push_back(make_pair(max(du[1], du[2]), t));
  }
  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;
  return 0;
}
