#include <bits/stdc++.h>
using namespace std;
class node {
 public:
  long long int second;
  long long int length;
};
long long int a[100001];
int main() {
  long long int n, i, k, l;
  cin >> n;
  vector<long long int> first, second;
  vector<pair<long long int, long long int> > ans;
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  int flag = a[n - 1];
  long long int one = 0, two = 0;
  for (i = 0; i < n; i++) {
    if (a[i] == 1)
      one++;
    else
      two++;
    first.push_back(one);
    second.push_back(two);
  }
  int t = 1, x_cord = 0, y_cord = 0, r1, r2;
  for (t = n; t >= 1; t--) {
    x_cord = 0, y_cord = 0;
    for (k = 0, l = 0;;) {
      vector<long long int>::iterator it;
      it = lower_bound(first.begin(), first.end(), x_cord + t);
      r1 = distance(first.begin(), it);
      it = lower_bound(second.begin(), second.end(), y_cord + t);
      r2 = distance(second.begin(), it);
      if (r1 == n && r2 == n) {
        break;
      }
      if (r1 < r2)
        x_cord = first[r1], y_cord = second[r1];
      else
        x_cord = first[r2], y_cord = second[r2];
      if (flag == 1) {
        if (r1 < r2)
          k++;
        else
          l++;
      }
      if (flag == 2) {
        if (r2 < r1)
          k++;
        else
          l++;
      }
      if (min(r1, r2) == n - 1) {
        if (k > l) ans.push_back(make_pair(k, t));
        break;
      }
    }
  }
  cout << ans.size() << endl;
  sort(ans.begin(), ans.end());
  for (i = 0; i < ans.size(); i++)
    cout << ans[i].first << " " << ans[i].second << endl;
  return 0;
}
