#include <bits/stdc++.h>
using namespace std;
const long long size = 1007;
const long long modulo = 1000000007;
const long long oo = 1e18;
const double EPS = 1e-12;
const double PI = acos(-1.0);
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1), k(2);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    --a[i];
    k[a[i]]++;
  }
  if (a[n] == 1) {
    for (int i = 1; i <= n; i++) a[i] = 1 - a[i];
    swap(k[0], k[1]);
  }
  vector<int> pref0(n + 1), pref1(n + 1);
  for (int i = 1; i <= n; i++) {
    pref0[i] = pref0[i - 1] + (a[i] == 0);
    pref1[i] = pref1[i - 1] + (a[i] == 1);
  }
  vector<pair<int, int> > ans;
  for (int t = 1; t <= k[0]; t++) {
    int s0 = 0, s1 = 0;
    int ind = 0;
    int sc0 = 0, sc1 = 0;
    while (ind < n) {
      int jump = min(t - sc0, t - sc1);
      if (ind + jump > n) {
        s1 = 999999999;
        break;
      }
      sc0 += pref0[ind + jump] - pref0[ind];
      sc1 += pref1[ind + jump] - pref1[ind];
      if (sc0 == t)
        ++s0, sc0 = sc1 = 0;
      else if (sc1 == t)
        ++s1, sc0 = sc1 = 0;
      ind += jump;
    }
    if (sc0 == 0 && sc1 == 0 && s0 > s1) ans.push_back(make_pair(s0, t));
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
