#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 100;
long long int arr[MAXN];
long long int pre1[MAXN];
long long int pre2[MAXN];
int n;
vector<pair<long long int, long long int> > v1;
bool comp(pair<int, int> p1, pair<int, int> p2) { return p1.first < p2.first; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (long long int i = 1; i <= n; i += 1) {
    cin >> arr[i];
    if (arr[i] == 1) {
      pre1[i] = 1;
    } else {
      pre2[i] = 1;
    }
    pre1[i] += pre1[i - 1];
    pre2[i] += pre2[i - 1];
  }
  long long int last = arr[n];
  long long int lastsum = 0;
  if (last == 1) {
    lastsum = pre1[n];
  } else {
    lastsum = pre2[n];
  }
  for (long long int i = 1; i <= n; i += 1) {
    long long int currpos = 0;
    long long int win1 = 0;
    long long int win2 = 0;
    while (currpos < n) {
      long long int cool1 =
          lower_bound(pre1 + 1, pre1 + n + 1, pre1[currpos] + i) - pre1;
      long long int cool2 =
          lower_bound(pre2 + 1, pre2 + n + 1, pre2[currpos] + i) - pre2;
      long long int best = min(cool1, cool2);
      currpos = best;
      if (cool1 < cool2) {
        win1 += 1;
      } else {
        win2 += 1;
      }
      if (best == n) {
        if (last == 1 && win1 > win2) {
          v1.push_back({win1, i});
        } else if (last == 2 && win2 > win1) {
          v1.push_back({win2, i});
        }
        break;
      }
    }
  }
  sort(v1.begin(), v1.end(), comp);
  cout << v1.size() << endl;
  for (int i = 0; i < v1.size(); i += 1) {
    cout << v1[i].first << " " << v1[i].second << endl;
  }
  return 0;
}
