#include <bits/stdc++.h>
const double PI = acos(-1.0);
using namespace std;
const int maxn = 1e5 + 100;
int n, a[maxn], p[maxn];
vector<pair<int, int> > ans;
int search(int start, int t) {
  if (p[n] - p[start] - (n - start) < t &&
      -(p[n] - p[start] - 2 * (n - start)) < t)
    return -1;
  int low = start, high = n;
  while (low < high) {
    int mid = (low + high) >> 1;
    int two = p[mid] - p[start] - (mid - start);
    int one = mid - start - two;
    if (one < t && two < t)
      low = mid + 1;
    else
      high = mid;
  }
  return low;
}
int main() {
  scanf("%d", &n);
  p[0] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    p[i] = p[i - 1] + a[i];
  }
  ans.clear();
  for (int t = 1; t <= n; t++) {
    int one = 0, two = 0, last = -1, x = 0, y;
    while (1) {
      y = search(x, t);
      if (y == -1) break;
      x = y;
      last = a[y];
      if (a[x] == 1) one++;
      if (a[x] == 2) two++;
    }
    if (x != n) continue;
    if (one >= two && last == 2) continue;
    if (two >= one && last == 1) continue;
    ans.push_back(make_pair(max(one, two), t));
  }
  printf("%d\n", ans.size());
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
