#include <bits/stdc++.h>
using namespace std;
constexpr int ms = 1e5 + 13;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<vector<int> > arr(2, vector<int>(n + 1, 0));
  vector<vector<int> > v_sum(2, vector<int>(n + 1));
  for (int i = 0; i < n; ++i) {
    int w;
    cin >> w;
    --w;
    arr[w][i + 1]++;
  }
  for (int i = 0; i < 2; ++i)
    partial_sum((arr[i]).begin(), (arr[i]).end(), v_sum[i].begin());
  vector<pair<int, int> > ans;
  for (int t = 1; t <= n; ++t) {
    int st = 1;
    array<int, 2> S = {0, 0};
    while (st <= n) {
      int fi = lower_bound(v_sum[0].begin() + st, v_sum[0].end(),
                           t + v_sum[0][st - 1]) -
               v_sum[0].begin();
      int se = lower_bound(v_sum[1].begin() + st, v_sum[1].end(),
                           t + v_sum[1][st - 1]) -
               v_sum[1].begin();
      if (fi == n + 1 && se == n + 1) goto not_today;
      S[0] += (fi < se ? 1 : 0);
      S[1] += (se < fi ? 1 : 0);
      st = min(fi, se) + 1;
    }
    if (S[0] > S[1] && arr[0][n] == 1) ans.emplace_back(S[0], t);
    if (S[1] > S[0] && arr[1][n] == 1) ans.emplace_back(S[1], t);
  not_today:;
  }
  sort((ans).begin(), (ans).end());
  cout << (int)(ans).size() << '\n';
  for (const auto& x : ans) cout << x.first << " " << x.second << '\n';
  return 0;
}
