#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 10;
int d[2][MAX_N], num[2];
vector<pair<int, int> > ans;
int main() {
  int n;
  cin >> n;
  num[0] = num[1] = 0;
  for (int i = 1, a; i <= n; i++) {
    cin >> a;
    d[a - 1][++num[a - 1]] = i;
  }
  int v = d[1][num[1]] > d[0][num[0]] ? 1 : 0;
  if (num[v] > num[1 - v]) {
    if (num[v] != 1) ans.push_back(make_pair(num[v], 1));
    ans.push_back(make_pair(1, num[v]));
  }
  for (int i = 2; i < num[v]; i++) {
    int s[2], j[2];
    s[0] = s[1] = 0;
    j[0] = j[1] = 1;
    for (; j[1 - v] + i - 1 <= num[1 - v] && j[v] + i - 1 <= num[v];) {
      int index = d[v][j[v] + i - 1] < d[1 - v][j[1 - v] + i - 1] ? v : 1 - v;
      s[index]++;
      j[index] = v == index ? j[v] + i : j[1 - v] + i;
      j[1 - index] =
          upper_bound(d[1 - index] + 1, d[1 - index] + 1 + num[1 - index],
                      d[index][j[index] - 1]) -
          d[1 - index];
    }
    s[v] += (num[v] - j[v] + 1) / i;
    if ((num[v] - j[v] + 1) % i == 0 && s[v] > s[1 - v] && j[v] <= num[v]) {
      ans.push_back(make_pair(s[v], i));
    }
  }
  cout << ans.size() << endl;
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}
