#include <bits/stdc++.h>
using namespace std;
int A[100005];
int ac[200005][3];
int M[200005][3];
vector<int> V[200005];
int n;
int evaluar(int t) {
  int pos = 0;
  int gJ = A[n - 1];
  int acm1 = 0;
  int acm2 = 0;
  int cnt[3];
  cnt[1] = cnt[2] = 0;
  while (pos != n) {
    int pos1 = M[acm1 + t][1];
    int pos2 = M[acm2 + t][2];
    if (!pos1 && !pos2) return 0;
    if (!pos1) pos1 = 1000000;
    if (!pos2) pos2 = 1000000;
    if (pos1 > pos2)
      cnt[2]++;
    else
      cnt[1]++;
    pos = min(pos1, pos2);
    acm1 = ac[pos][1];
    acm2 = ac[pos][2];
  }
  if (cnt[gJ] > cnt[3 - gJ])
    return cnt[gJ];
  else
    return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); i++) scanf("%d", &A[i]);
  ac[0][1] = ac[0][2] = 0;
  for (int j = (1); j < (3); j++)
    for (int i = (0); i < (n); i++) {
      ac[i + 1][j] = ac[i][j] + (A[i] == j);
    }
  for (int j = (1); j < (3); j++)
    for (int i = n; i >= 0; i--) {
      M[ac[i][j]][j] = i;
    }
  int s;
  for (int i = (1); i < (n + 1); i++)
    if (s = evaluar(i)) {
      V[s].push_back(i);
    }
  int tot = 0;
  for (int i = (1); i < (100005); i++)
    if (V[i].size() >= 1) {
      tot += V[i].size();
      sort((V[i]).begin(), (V[i]).end());
    }
  cout << tot << endl;
  for (int i = (1); i < (100005); i++)
    if (V[i].size()) {
      for (int j = (0); j < (V[i].size()); j++) printf("%d %d\n", i, V[i][j]);
    }
  return 0;
}
