#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ans;
int a[100007], cnt[2][100007];
void solve(int len, int t, int n) {
  int c[2], num[2];
  c[0] = c[1] = len;
  num[0] = num[1] = 0;
  int pre = 0, pos = 0;
  int flag = -1;
  while (true) {
    if (c[t] < c[t ^ 1])
      pos += c[t];
    else
      pos += c[t ^ 1];
    if (pos > n) break;
    if (cnt[t][pos] - cnt[t][pre] == len) {
      num[t]++;
      pre = pos;
      c[t] = c[t ^ 1] = len;
      flag = 1;
    } else if (cnt[t ^ 1][pos] - cnt[t ^ 1][pre] == len) {
      num[t ^ 1]++;
      pre = pos;
      c[t] = c[t ^ 1] = len;
      flag = 0;
    } else {
      c[t] = len - (cnt[t][pos] - cnt[t][pre]);
      c[t ^ 1] = len - (cnt[t ^ 1][pos] - cnt[t ^ 1][pre]);
      flag = -1;
    }
    if (pos == n) break;
  }
  if (flag == 1 && pos == n && num[t] > num[t ^ 1]) {
    ans.push_back(make_pair(num[t], len));
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int ac = 0, bc = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (a[i] == 1)
      ac++;
    else
      bc++;
    cnt[0][i] = ac;
    cnt[1][i] = bc;
  }
  int t = a[n] - 1;
  for (int i = 1; i <= n; ++i) {
    if (cnt[t][i] < cnt[t ^ 1][i] && cnt[t ^ 1][i - 1] < cnt[t ^ 1][i])
      solve(cnt[t ^ 1][i], t, n);
    else if (cnt[t][i] > cnt[t ^ 1][i] && cnt[t][i] > cnt[t][i - 1])
      solve(cnt[t][i], t, n);
  }
  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;
  }
  return 0;
}
