#include <bits/stdc++.h>
using namespace std;
long long a[500000];
long long b[500000];
long long c[500000];
long long d[500000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, i;
  cin >> n;
  for (i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    if (x == 1)
      a[i]++;
    else
      b[i]++;
  }
  for (i = 1; i <= n; i++) {
    a[i] += a[i - 1];
    b[i] += b[i - 1];
  }
  for (i = 1; i <= 3 * n; i++) {
    c[i] = 1e10;
    d[i] = 1e10;
  }
  for (i = 1; i <= n; i++) {
    if (c[a[i]] == 1e10) c[a[i]] = i;
    if (d[b[i]] == 1e10) d[b[i]] = i;
  }
  vector<pair<long long, long long> > v;
  for (long long l = 1; l <= n; l++) {
    long long x = 0, y = 0;
    long long px, py;
    long long sx = 0, sy = 0;
    long long last = 0;
    while (1) {
      if (c[x + l] > d[y + l]) {
        px = a[d[y + l]];
        py = b[d[y + l]];
        sy++;
        last = 2;
      } else if (c[x + l] < d[y + l]) {
        px = a[c[x + l]];
        py = b[c[x + l]];
        sx++;
        last = 1;
      } else {
        if (c[x] == n || d[y] == n)
          ;
        else {
          sx = 0;
          sy = 0;
        }
        if (sx == sy) sx = 0, sy = 0;
        if (sx > sy && last == 2 || sy > sx && last == 1) {
          sx = 0;
          sy = 0;
        }
        break;
      }
      x = px;
      y = py;
    }
    if (max(sx, sy) > 0) v.push_back(make_pair(max(sx, sy), l));
  }
  sort((v).begin(), (v).end());
  if (v.empty())
    cout << 0;
  else {
    cout << v.size() << "\n";
    for (i = 0; i < v.size(); i++) {
      cout << v[i].first << " " << v[i].second << "\n";
    }
  }
  return 0;
}
