#include <bits/stdc++.h>
using namespace std;
void scan(int &x) {
  register int c = getchar();
  x = 0;
  for (; (c < 48 || c > 57); c = getchar())
    ;
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, a[123456], g[123456], p[123456];
  while (cin >> n) {
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (i != 0) {
        p[i] = p[i - 1] + (a[i] == 1);
        g[i] = g[i - 1] + (a[i] == 2);
      } else {
        p[i] = (a[i] == 1);
        g[i] = (a[i] == 2);
      }
    }
    int ctg, ctp, kp, kg, pw, gw;
    vector<pair<int, int> > v;
    for (int i = 1; i <= n; i++) {
      ctp = 0, ctg = 0;
      kp = i, kg = i;
      while (1) {
        pw = lower_bound(p, p + n, kp) - p;
        gw = lower_bound(g, g + n, kg) - g;
        if (pw == n || p[pw] != kp) pw = n;
        if (gw == n || g[gw] != kg) gw = n;
        if (pw != n && pw < gw) {
          ctp++, kg = g[pw] + i, kp = p[pw] + i;
          if (ctp > ctg && pw == n - 1) v.push_back(make_pair(ctp, i));
        } else if (gw != n && gw < pw) {
          ctg++, kg = g[gw] + i, kp = p[gw] + i;
          if (ctg > ctp && gw == n - 1) v.push_back(make_pair(ctg, i));
        } else
          break;
      }
    }
    cout << v.size() << endl;
    sort(v.begin(), v.end());
    for (int i = 0; i < (int)v.size(); i++)
      cout << v[i].first << " " << v[i].second << endl;
  }
  return 0;
}
