#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 7;
const long long mod = 1e9 + 7;
const long long mod1 = 123456789;
const int maxx = 5005;
long long q, t, n, m, T, k, ans, a[maxn], b[maxn], N;
pair<long long, long long> pr[maxn];
string s, str;
vector<pair<long long, long long> > kq;
bool check;
void test() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> m;
    pr[i].first = pr[i - 1].first;
    pr[i].second = pr[i - 1].second;
    if (m == 1) {
      ++pr[i].first;
      a[pr[i].first] = i;
    } else {
      ++pr[i].second;
      b[pr[i].second] = i;
    }
  }
  if (m == 1) {
    for (int i = 1; i <= pr[n].first; i++) {
      check = true;
      long long ta = 0, tb = 0, da = 0, db = 0;
      while (ta + i <= pr[n].first) {
        long long r1 = a[ta + i], r2 = b[tb + i];
        if (tb + i > pr[n].second || r1 < r2) {
          ta = pr[r1].first;
          tb = pr[r1].second;
          k = r1;
          ++da;
        } else {
          ta = pr[r2].first;
          tb = pr[r2].second;
          ++db;
        }
      }
      if (k != n || da <= db) check = false;
      if (check) {
        kq.push_back({da, i});
      }
    }
  } else {
    for (int i = 1; i <= pr[n].second; i++) {
      check = true;
      long long ta = 0, tb = 0, da = 0, db = 0;
      while (tb + i <= pr[n].second) {
        long long r1 = a[ta + i], r2 = b[tb + i];
        if (ta + i > pr[n].first || r1 > r2) {
          ta = pr[r2].first;
          tb = pr[r2].second;
          k = r2;
          ++db;
        } else {
          ta = pr[r1].first;
          tb = pr[r1].second;
          ++da;
        }
      }
      if (k != n || da >= db) check = false;
      if (check) {
        kq.push_back({db, i});
      }
    }
  }
  sort(kq.begin(), kq.end());
  cout << kq.size() << '\n';
  for (pair<long long, long long> u : kq)
    cout << u.first << " " << u.second << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  test();
}
