#include <bits/stdc++.h>
using namespace std;
int n, cnt;
int a[(100100)];
int f[(100100)][3];
pair<int, int> V[(100100)];
int Getpos(int pos, int k, int c) {
  if (f[n][c] - f[pos][c] < k) return n + 1;
  int l = pos + 1, r = n, mid;
  while (l != r) {
    mid = l + r >> 1;
    if (f[mid][c] - f[pos][c] < k) {
      l = mid + 1;
    } else {
      r = mid;
    }
  }
  return l;
}
int calc(int k) {
  int win_1(0), win_2(0), pos(0), pos_1, pos_2;
  while (true) {
    pos_1 = Getpos(pos, k, 1);
    pos_2 = Getpos(pos, k, 2);
    if (pos_1 > n && pos_2 > n) return -1;
    if (pos_1 < pos_2) {
      pos = pos_1;
      win_1++;
    } else {
      pos = pos_2;
      win_2++;
    }
    if (pos == n) {
      if (pos_1 < pos_2 && win_1 <= win_2) {
        return -1;
      }
      if (pos_2 < pos_1 && win_2 <= win_1) {
        return -1;
      }
      return max(win_1, win_2);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    f[i][a[i]] = 1;
  }
  for (int i = 1; i <= n; i++) {
    f[i][1] += f[i - 1][1];
    f[i][2] += f[i - 1][2];
  }
  for (int i = 1; i <= n; i++) {
    int j = calc(i);
    if (j != -1) V[++cnt] = make_pair(j, i);
  }
  sort(V + 1, V + cnt + 1);
  cout << cnt << endl;
  for (int i = 1; i <= cnt; i++)
    cout << V[i].first << ' ' << V[i].second << endl;
  return 0;
}
