#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long> pref_1(n + 1, 0), pref_2(n + 1, 0),
      serves_1(2 * n, INT_MAX), serves_2(2 * n, INT_MAX);
  serves_1[0] = 0, serves_2[0] = 0;
  long long p1p = 0, p2p = 0;
  pref_1[1] = (a[0] == 1) ? 1 : 0;
  pref_2[1] = (a[0] == 2) ? 1 : 0;
  if (a[0] == 1) {
    p1p = 1;
    serves_1[1] = 1;
  } else {
    p2p = 1;
    serves_2[1] = 1;
  }
  for (long long i = 1; i < n; i++) {
    if (a[i] == 1) {
      p1p++;
      pref_1[i + 1] = 1 + pref_1[i];
      pref_2[i + 1] = pref_2[i];
      serves_1[p1p] = i + 1;
    } else {
      p2p++;
      pref_1[i + 1] = pref_1[i];
      pref_2[i + 1] = 1 + pref_2[i];
      serves_2[p2p] = i + 1;
    }
  }
  vector<array<long long, 2>> res;
  for (long long t = 1; t <= n; t++) {
    long long start_idx = 0;
    long long serves_played = 0;
    long long set_won_1 = 0, set_won_2 = 0;
    long long last_set_winner = -1;
    while (serves_played + t <= n) {
      if (serves_1[pref_1[serves_played] + t] <
          serves_2[pref_2[serves_played] + t]) {
        set_won_1++;
        serves_played = serves_1[pref_1[serves_played] + t];
        last_set_winner = 1;
      } else {
        set_won_2++;
        serves_played = serves_2[pref_2[serves_played] + t];
        last_set_winner = 2;
      }
    }
    if (serves_played != n || set_won_1 == set_won_2) {
      continue;
    }
    if (set_won_1 > set_won_2 && last_set_winner != 1) continue;
    if (set_won_2 > set_won_1 && last_set_winner != 2)
      continue;
    else {
      res.push_back({max(set_won_1, set_won_2), t});
    }
  }
  cout << res.size() << "\n";
  sort(res.begin(), res.end());
  for (auto a : res) {
    cout << a[0] << " " << a[1] << "\n";
  }
  return 0;
}
