#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:133217728")
using namespace std;
const int INF = 1e+9;
const int MAX = 1e+6;
int a[MAX];
vector<pair<int, int> > sol;
int k[2][MAX];
int n;
bool ok(int t, int& s) {
  int k1 = 0;
  int k2 = 0;
  int j = 0;
  int last;
  while (j < n) {
    int l[2] = {j, j};
    int r[2] = {n, n};
    int ans[2] = {n + 1, n + 1};
    for (int val = (0); val < (2); ++val) {
      if (k[val][n] - k[val][j] < t) continue;
      while (r[val] - l[val] > 1) {
        int m = (r[val] + l[val]) / 2;
        if (k[val][m] - k[val][j] >= t) {
          r[val] = m;
        } else {
          l[val] = m;
        }
      }
      ans[val] = l[val] + 1;
    }
    if (min(ans[0], ans[1]) == n + 1) return false;
    j = min(ans[0], ans[1]);
    if (ans[0] < ans[1]) {
      ++k1;
      last = 0;
    } else {
      ++k2;
      last = 1;
    }
  }
  if (k1 == k2) return false;
  if (k1 > k2 && last == 1) return false;
  if (k1 < k2 && last == 0) return false;
  s = max(k1, k2);
  return true;
}
int main() {
  cin >> n;
  for (int i = (0); i < (n); ++i) cin >> a[i];
  k[0][0] = 0;
  k[1][0] = 0;
  for (int i = (1); i < (n + 1); ++i) {
    k[0][i] = k[0][i - 1];
    k[1][i] = k[1][i - 1];
    k[a[i - 1] - 1][i]++;
  }
  for (int t = (1); t < (n + 1); ++t) {
    int s;
    bool temp = ok(t, s);
    if (temp) {
      sol.push_back(make_pair(s, t));
    }
  }
  sort((sol).begin(), (sol).end());
  cout << sol.size() << endl;
  for (int i = (0); i < (sol.size()); ++i) {
    cout << sol[i].first << " " << sol[i].second << endl;
  }
  return 0;
}
