#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> A, B;
int check(int i, int j, int k) {
  if (A[j] - A[i - 1] >= k) return 1;
  if (B[j] - B[i - 1] >= k) return 2;
  return 0;
}
long long fun(int a) {
  int lo, hi, mid, start, r;
  start = 1;
  r = 2 * (a - 1) + 1;
  long long e = 0, w = 0;
  long long ww = 0;
  while (start + a - 1 <= n) {
    lo = start;
    hi = min(n, start + r - 1);
    while (lo < hi) {
      mid = lo + (hi - lo) / 2;
      if (check(start, mid, a)) {
        hi = mid;
      } else {
        lo = mid + 1;
      }
    }
    mid = lo + (hi - lo) / 2;
    if (check(start, mid, a) == 1) {
      e++;
      ww = 1;
    } else if (check(start, mid, a) == 2) {
      w++;
      ww = 2;
    } else {
      mid = n + 1;
    }
    start = mid + 1;
  }
  if (start != n + 1) {
    return -1;
  }
  if (e > w && ww == 1) {
    return e;
  }
  if (w > e && ww == 2) {
    return w;
  }
  return -1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long x, a, b;
  cin >> n;
  a = b = 0;
  A.push_back(0);
  B.push_back(0);
  for (long long i = 0; i < n; i++) {
    cin >> x;
    if (x == 1) {
      a++;
    } else {
      b++;
    }
    A.push_back(a);
    B.push_back(b);
  }
  long long r;
  vector<pair<int, int> > ans;
  for (long long i = 1; i <= n; i++) {
    r = fun(i);
    if (r != -1) {
      ans.push_back(make_pair(r, i));
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (long long i = 0; i < (long long)ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}
