#include <bits/stdc++.h>
using namespace std;
const int N = 200005, INF = 1000000000;
int last[2];
int first[N][2];
int sum[N][2];
int arr[N];
vector<pair<int, int> > ans;
int main() {
  int i, j, n, it, s[2];
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
    arr[i]--;
  }
  for (i = 1; i < N; i++) {
    first[i][0] = INF;
    first[i][1] = INF;
  }
  for (i = 1; i <= n; i++) {
    sum[i][0] = sum[last[0]][0];
    sum[i][1] = sum[last[1]][1];
    sum[i][arr[i]] = sum[last[arr[i]]][arr[i]] + 1;
    last[arr[i]] = i;
    int &mini = first[sum[i][arr[i]]][arr[i]];
    mini = min(mini, i);
  }
  for (int t = 1; t <= n; t++) {
    it = 0;
    s[0] = 0;
    s[1] = 0;
    int up;
    while (it < n) {
      int x = first[sum[it][0] + t][0] < first[sum[it][1] + t][1];
      s[x]++;
      up = x;
      it = min(first[sum[it][0] + t][0], first[sum[it][1] + t][1]);
    }
    if (it == n && s[up] > s[1 - up])
      ans.push_back(pair<int, int>(max(s[0], s[1]), t));
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (auto el : ans) printf("%d %d\n", el.first, el.second);
  return 0;
}
