#include <bits/stdc++.h>
using namespace std;
long long ll, tt, i, j, a[234567], b[211212], c[211456], d[213456];
long long x, m, n, r, s, t, k, l, y, z;
vector<long long> p[12], q;
pair<long long, long long> pp[345678];
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> x;
    if (x == 1) {
      a[i]++;
    } else {
      b[i]++;
    }
    a[i] += a[i - 1];
    b[i] += b[i - 1];
  }
  for (t = 1; t <= n; t++) {
    x = 0;
    y = 0;
    l = 0;
    r = 0;
    z = 0;
    do {
      x = lower_bound(a + z + 1, a + n + 1, a[z] + t) - a;
      y = lower_bound(b + z + 1, b + n + 1, b[z] + t) - b;
      if (x < y) {
        l++;
        z = x;
      } else {
        r++;
        z = y;
      }
    } while (x + y <= 2 * n);
    if (z == n && l != r) {
      if (x == n && l < r) continue;
      if (y == n && l > r) continue;
      pp[s].first = max(l, r);
      pp[s].second = t;
      s++;
    }
  }
  sort(pp, pp + s);
  cout << s << endl;
  for (i = 0; i < s; i++) cout << pp[i].first << ' ' << pp[i].second << endl;
  return 0;
}
