#include <bits/stdc++.h>
const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const double eps = 1e-7;
const int mod = 1e9 + 7;
const double pi = acos(-1.0);
using namespace std;
vector<pair<int, int> > ans;
int f[maxn], g[maxn], a[maxn], b[maxn];
int main() {
  memset(f, 0x3f, sizeof(f));
  memset(g, 0x3f, sizeof(g));
  int n;
  cin >> n;
  int t = 0, n1 = 0, n2 = 0;
  for (int i = 1; i <= n; i++) {
    cin >> t;
    if (t == 1) f[++n1] = i;
    if (t == 2) g[++n2] = i;
    a[i] = n1, b[i] = n2;
  }
  for (int t = 1; t <= n; t++) {
    int ff = 0;
    int s1 = 0, s2 = 0, cur1 = 0, cur2 = 0;
    for (int c = 0; c <= n;) {
      if (cur1 + t > n1 && cur2 + t > n2) {
        ff = 1;
        break;
      }
      int x = f[cur1 + t], y = g[cur2 + t];
      int hh = min(x, y);
      if (x < y)
        s1++;
      else
        s2++;
      cur1 = a[hh], cur2 = b[hh];
      if (hh == n) {
        if (x < y && s1 < s2) ff = 1;
        if (x > y && s1 > s2) ff = 1;
        if (s1 == s2) ff = 1;
        break;
      }
      c = hh;
    }
    if (!ff) ans.push_back(make_pair(max(s1, s2), t));
  }
  sort(ans.begin(), ans.end());
  int cc = ans.size();
  cout << cc << endl;
  for (int i = 0; i < cc; i++)
    cout << ans[i].first << " " << ans[i].second << endl;
  return 0;
}
