#include <bits/stdc++.h>
using namespace std;
void fastStream() {
  cin.tie(0);
  std::ios_base::sync_with_stdio(0);
}
int N;
int A[100010];
int sums[2][100010];
int main() {
  fastStream();
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < 2; j++) sums[j][i + 1] = sums[j][i] + ((j + 1) == A[i]);
  vector<pair<int, int> > res;
  for (int t = 1; t <= N; t++) {
    int pos = 0;
    int f_set = 0;
    int s_set = 0;
    bool fail = false;
    bool last_is_f = false;
    while (pos < N) {
      int ub = N - 1;
      int lb = pos - 1;
      while (ub - lb > 1) {
        const int mid = (ub + lb) / 2;
        bool ok = false;
        for (int j = 0; j < 2; j++)
          ok |= (sums[j][mid + 1] - sums[j][pos] >= t);
        if (ok)
          ub = mid;
        else
          lb = mid;
      }
      if (sums[0][ub + 1] - sums[0][pos] == t ||
          sums[1][ub + 1] - sums[1][pos] == t) {
        f_set += (sums[0][ub + 1] - sums[0][pos] == t);
        s_set += (sums[1][ub + 1] - sums[1][pos] == t);
        last_is_f = (sums[0][ub + 1] - sums[0][pos] == t);
        pos = ub + 1;
      } else {
        fail = true;
        break;
      }
    }
    if (!fail) {
      if ((last_is_f && f_set > s_set) || (!last_is_f && f_set < s_set)) {
        res.push_back(pair<int, int>(max(f_set, s_set), t));
      }
    }
  }
  cout << res.size() << endl;
  sort(res.begin(), res.end());
  for (int i = 0; i < (int)res.size(); i++) {
    cout << res[i].first << " " << res[i].second << endl;
  }
  return 0;
}
