#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ans;
int a[100001], b[100001];
int n;
int bs(int *z, int x) {
  if (z[n] < x) return n + 1;
  int lo = 1, hi = n;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    if (z[mid] >= x)
      hi = mid;
    else
      lo = mid + 1;
  }
  return lo;
}
bool sorter(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first < b.first;
}
int main() {
  int score1 = 0, score2 = 0, s1 = 0, s2 = 0;
  scanf("%d", &n);
  int x;
  bool flag = false;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    if (x == 1)
      a[i] = a[i - 1] + 1, b[i] = b[i - 1];
    else
      b[i] = b[i - 1] + 1, a[i] = a[i - 1];
    if (i == n) {
      if (x == 1)
        flag = false;
      else
        flag = true;
    }
  }
  for (int i = n; i >= 1; i--) {
    int s1 = 0, s2 = 0, l1 = 0, l2 = 0, last = 0;
    while (true) {
      int f = bs(a, l1 + i);
      int s = bs(b, l2 + i);
      if (f > n && s > n) break;
      if (f < s) {
        s1++;
        last = f;
      } else {
        s2++;
        last = s;
      }
      l1 = a[last];
      l2 = b[last];
      if (last == n) {
        if (!flag && s1 > s2) {
          ans.push_back({s1, i});
        } else if (flag && s2 > s1) {
          ans.push_back({s2, i});
        }
        break;
      }
    }
  }
  sort(ans.begin(), ans.end(), sorter);
  x = ans.size();
  cout << x << endl;
  for (int i = 0; i < x; i++) {
    cout << ans[i].first << " " << ans[i].second << '\n';
  }
  return 0;
}
