#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000 + 7;
int a[MAXN];
int ps[MAXN][3];
int get(int l, int r, int k) { return ps[r][k] - ps[l - 1][k]; }
int calc(int l, int r) { return max(get(l, r, 1), get(l, r, 2)); }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    for (int j = 1; j <= 2; j++) {
      ps[i][j] = ps[i - 1][j];
    }
    ps[i][a[i]]++;
  }
  vector<pair<int, int> > res;
  if (ps[n][1] != ps[n][2]) {
    if (ps[n][1] > ps[n][2] && a[n] == 1) {
      res.push_back(make_pair(1, ps[n][1]));
    } else if (ps[n][1] < ps[n][2] && a[n] == 2) {
      res.push_back(make_pair(1, ps[n][2]));
    }
  }
  for (int i = 2; i <= n; i++) {
    int x = 1;
    bool ok = true;
    int cnt1 = 0, cnt2 = 0;
    int lst = -1;
    while (x <= n) {
      if (calc(x, n) < i) {
        ok = false;
        break;
      }
      int l = x, r = n;
      while (r - l > 1) {
        int m = (l + r) / 2;
        if (calc(x, m) >= i) {
          r = m;
        } else {
          l = m;
        }
      }
      if (get(x, r, 1) == i) {
        lst = 1;
        cnt1++;
      } else {
        lst = 2;
        cnt2++;
      }
      x = r + 1;
    }
    if (cnt1 > cnt2 && lst != 1) ok = false;
    if (cnt1 < cnt2 && lst != 2) ok = false;
    if (cnt1 != cnt2 && ok) {
      res.push_back(make_pair(i, max(cnt1, cnt2)));
    }
  }
  for (int i = 0; i < (int)res.size(); i++) {
    swap(res[i].first, res[i].second);
  }
  sort(res.begin(), res.end());
  printf("%d\n", (int)res.size());
  for (int i = 0; i < (int)res.size(); i++) {
    printf("%d %d\n", res[i].first, res[i].second);
  }
  return 0;
}
