#include <bits/stdc++.h>
using namespace std;
int n;
int sum[100003][3];
vector<pair<int, int> > res;
int check(int x, int y, int t) {
  if (sum[y][1] - sum[x][1] >= t) return 1;
  if (sum[y][2] - sum[x][2] >= t) return 2;
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1, x; i <= n; i++) {
    scanf("%d", &x);
    sum[i][1] = sum[i - 1][1];
    sum[i][2] = sum[i - 1][2];
    sum[i][x]++;
  }
  for (int t = 1; t <= n; t++) {
    int last = 0, lastw = 0;
    int cnt[3] = {0, 0, 0};
    while (last < n) {
      int l = last + 1, r = n, lo = 0, last2 = n + 1;
      while (l <= r) {
        int mid = (l + r) >> 1;
        int x = check(last, mid, t);
        if (!x)
          l = mid + 1;
        else
          r = mid - 1, lo = x, last2 = mid;
      }
      lastw = lo;
      cnt[lo]++;
      last = last2;
    }
    if (last > n) continue;
    if (cnt[1] == cnt[2]) continue;
    if (cnt[1] > cnt[2] && lastw == 2) continue;
    if (cnt[2] > cnt[1] && lastw == 1) continue;
    res.push_back(pair<int, int>(max(cnt[1], cnt[2]), t));
  }
  sort(res.begin(), res.end());
  printf("%d\n", res.size());
  for (int i = 0; i < (int)res.size(); i++)
    printf("%d %d\n", res[i].first, res[i].second);
  return 0;
}
