#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> x(n + 1);
  vector<int> y(n + 1);
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    if (p == 2)
      y[i + 1]++;
    else
      x[i + 1]++;
  }
  partial_sum((x).begin(), (x).end(), x.begin());
  partial_sum((y).begin(), (y).end(), y.begin());
  vector<pair<int, int> > ans;
  for (int s = 1; s < 1 + max(x.back(), y.back()); s++) {
    int cur = 0;
    int cnt1 = 0, cnt2 = 0;
    bool isGood = 0;
    int last = 0;
    while (true) {
      auto it1 = lower_bound((x).begin(), (x).end(), x[cur] + s);
      auto it2 = lower_bound((y).begin(), (y).end(), y[cur] + s);
      if (it1 == x.end() && it2 == y.end()) break;
      if (it1 - x.begin() < it2 - y.begin()) {
        cnt1++;
        if (x.end() - it1 == 1) isGood = 1;
        cur = it1 - x.begin();
        last = 1;
      } else {
        cnt2++;
        if (y.end() - it2 == 1) isGood = 1;
        cur = it2 - y.begin();
        last = 2;
      }
    }
    if (isGood && ((cnt1 > cnt2) ^ (last - 1)) && cnt2 != cnt1)
      ans.push_back(make_pair(max(cnt1, cnt2), s));
  }
  sort((ans).begin(), (ans).end());
  cout << (int)ans.size() << '\n';
  for (auto i : ans) {
    cout << i.first << " " << i.second << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
