#include <bits/stdc++.h>
using namespace std;
int n;
int niz[100005];
vector<int> a, b, ab, ba;
vector<pair<int, int> > res;
int main() {
  scanf("%d", &n);
  a.push_back(0);
  b.push_back(0);
  ab.push_back(0);
  ba.push_back(0);
  for (int i = 1; i <= n; i++) {
    scanf("%d", niz + i);
    if (niz[i] == 1) {
      a.push_back(i);
      ab.push_back(b.size() - 1);
    } else {
      b.push_back(i);
      ba.push_back(a.size() - 1);
    }
  }
  for (int t = 1; t <= n; t++) {
    int proslo = 0;
    int ta = 0, tb = 0;
    int pa = 0, pb = 0;
    int pp = 0;
    while (true) {
      if (proslo == n) {
        pp = (pa > pb ? 1 : 2);
        if (pa == pb || (pp == 1 && niz[n] == 2) || (pp == 2 && niz[n] == 1))
          goto nista;
        else {
          res.push_back(make_pair(max(pa, pb), t));
          goto nista;
        }
      }
      if (ta + t > a.size() - 1) {
        if (tb + t > b.size() - 1) {
          goto nista;
        }
        proslo += t + ba[tb + t] - ta;
        pb++;
        tb += t;
        ta = ba[tb];
        pp = 2;
      } else if (tb + t > b.size() - 1) {
        proslo += t + ab[ta + t] - tb;
        pa++;
        ta += t;
        tb = ab[ta];
        pp = 1;
      } else {
        if (a[ta + t] < b[tb + t]) {
          proslo += t + ab[ta + t] - tb;
          pa++;
          ta += t;
          tb = ab[ta];
          pp = 1;
        } else {
          proslo += t + ba[tb + t] - ta;
          pb++;
          tb += t;
          ta = ba[tb];
          pp = 2;
        }
      }
    }
  nista:
    continue;
  }
  printf("%d\n", res.size());
  sort(res.begin(), res.end());
  for (int i = 0; i < res.size(); i++)
    printf("%d %d\n", res[i].first, res[i].second);
  return 0;
}
