#include <bits/stdc++.h>
using namespace std;
int n, a[100100], pref1[100100], pref2[100100];
vector<pair<int, int> > ans;
void check(int par) {
  int minuss1 = 0, minuss2 = 0, wins1 = 0, wins2 = 0;
  int uk = 0, lst = 0;
  int l, r, l2, r2, midl;
  while (uk < n) {
    l = uk;
    r = n + 1;
    while (r - l > 1) {
      midl = (l + r) / 2;
      if (pref1[midl] - minuss1 < par) {
        l = midl;
      } else {
        r = midl;
      }
    }
    l2 = uk;
    r2 = n + 1;
    while (r2 - l2 > 1) {
      midl = (l2 + r2) / 2;
      if (pref2[midl] - minuss2 < par) {
        l2 = midl;
      } else {
        r2 = midl;
      }
    }
    if (r2 == r) {
      return;
    }
    if (r < r2) {
      minuss1 = pref1[r];
      minuss2 = pref2[r];
      uk = r;
      wins1++;
      lst = 1;
    } else {
      minuss1 = pref1[r2];
      minuss2 = pref2[r2];
      uk = r2;
      wins2++;
      lst = 2;
    }
  }
  if (wins1 == wins2) {
    return;
  }
  if (wins1 > wins2 && lst == 2) return;
  if (wins1 < wins2 && lst == 1) return;
  ans.push_back(make_pair(max(wins1, wins2), par));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    pref1[i] = pref1[i - 1];
    pref2[i] = pref2[i - 1];
    if (a[i] == 1) {
      pref1[i]++;
    } else {
      pref2[i]++;
    }
  }
  for (int i = n; i >= 1; --i) {
    check(i);
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); ++i) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
}
