#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 * 100 + 100;
long long int a[maxn], b[maxn], add, akharin, err;
long long int javab[maxn];
void tashkhis(long long int n, long long int t) {
  long long int na = 0, nd = 0, temp;
  for (long long int i = t; i <= n; i += t) {
    temp = i;
    while (i <= n) {
      if (a[i] - a[temp - t] == t) {
        na++;
        break;
      } else if (b[i] - b[temp - t] == t) {
        nd++;
        break;
      }
      if (i == n) return;
      i += t - max(a[i] - a[temp - t], b[i] - b[temp - t]);
    }
    if (i < n && i + t > n) return;
    err = i;
  }
  if (na < nd && akharin == 2 && err == n) {
    javab[add] = nd * 1000000 + t;
    add++;
  } else if (nd < na && akharin == 1 && err == n) {
    javab[add] = na * 1000000 + t;
    add++;
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> akharin;
    if (akharin == 1) {
      a[i] = a[i - 1] + 1;
      b[i] = b[i - 1];
    } else {
      b[i] = b[i - 1] + 1;
      a[i] = a[i - 1];
    }
  }
  for (long long int t = max(a[n], b[n]); t > 0; t--) tashkhis(n, t);
  cout << add << endl;
  sort(javab, javab + add);
  for (int i = 0; add > i; i++)
    cout << javab[i] / 1000000 << " " << javab[i] % 1000000 << endl;
}
