#include <bits/stdc++.h>
using namespace std;
const long long infl = 1e18 + 5;
long long int n, m, k, q, x, y, f, val, t = 1, i, j;
long long int ind = -1, cnt, sz, sm, ans, mx = -1, mn = infl;
long long int a[100014], b[100014], last;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("inp.txt", "r")) {
    freopen("myfile.txt", "w", stdout);
    freopen("inp.txt", "r", stdin);
  }
  cin >> n;
  for (i = 1; i < n + 1; i++) {
    cin >> x;
    x--;
    last = x;
    b[i] = b[i - 1];
    a[i] = a[i - 1];
    if (x == 0)
      a[i]++;
    else
      b[i]++;
  }
  a[n + 1] = infl;
  b[n + 1] = infl;
  vector<pair<long long int, long long int> > v;
  for (i = 1; i < n + 1; i++) {
    long long int prev = 0, p1, p2, it = 0, x = 0, y = 0;
    while (true) {
      p1 = lower_bound(a + prev, a + n + 1, a[prev] + i) - a;
      p2 = lower_bound(b + prev, b + n + 1, b[prev] + i) - b;
      if (min(p1, p2) == n + 1) break;
      if (p1 < p2) {
        x++;
        prev = p1;
      } else {
        y++;
        prev = p2;
      }
    }
    if (x == y || prev != n) continue;
    if (x > y && last == 1 || y > x && last == 0)
      continue;
    else
      v.push_back({max(x, y), i});
  }
  sort(v.begin(), v.end());
  cout << v.size() << "\n";
  for (i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << "\n";
  return 0;
}
