#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e5;
const int Magic = 5e2;
const int INF = 1e9;
int a[MaxN];
int n;
vector<pair<int, int> > res;
int sum[2][MaxN];
void solveMinT(int t) {
  int score[2] = {0, 0};
  int cur[2] = {0, 0};
  for (int i = 0; i < n; i++) {
    cur[a[i] - 1]++;
    if (cur[a[i] - 1] == t) {
      score[a[i] - 1]++;
      cur[0] = cur[1] = 0;
    }
  }
  if (cur[0] != 0 || cur[1] != 0) return;
  if (score[0] == score[1]) return;
  if (score[0] > score[1] && a[n - 1] == 1)
    res.push_back(make_pair(score[0], t));
  if (score[1] > score[0] && a[n - 1] == 2)
    res.push_back(make_pair(score[1], t));
}
int getPos(int row, int score) {
  int l = 0, r = n - 1;
  if (sum[row][n - 1] < score) return INF;
  while (l < r - 1) {
    int mid = (l + r) / 2;
    if (sum[row][mid] < score)
      l = mid;
    else
      r = mid;
  }
  if (sum[row][l] == score) return l;
  return r;
}
void solveMinS(int s, int t) {
  int score1 = 0, score2 = 0;
  int sets[2] = {0, 0};
  int pos1, pos2;
  while (sets[0] != s && sets[1] != s) {
    pos1 = getPos(0, score1 + t);
    pos2 = getPos(1, score2 + t);
    if (pos1 == INF && pos2 == INF) return;
    if (pos1 < pos2) {
      sets[0]++;
      score1 = sum[0][pos1];
      score2 = sum[1][pos1];
    } else {
      sets[1]++;
      score1 = sum[0][pos2];
      score2 = sum[1][pos2];
    }
  }
  if (min(pos1, pos2) != n - 1) return;
  if (a[n - 1] == 1 && sets[0] == s && sets[1] < s && pos1 == n - 1)
    res.push_back(make_pair(s, t));
  if (a[n - 1] == 2 && sets[1] == s && sets[0] < s && pos2 == n - 1)
    res.push_back(make_pair(s, t));
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (i != 0) {
      sum[0][i] = sum[0][i - 1];
      sum[1][i] = sum[1][i - 1];
    }
    sum[a[i] - 1][i]++;
  }
  for (int t = 1; t <= min(Magic, n); t++) solveMinT(t);
  for (int t = Magic + 1; t <= n; t++)
    for (int s = 1; s * t <= n; s++) solveMinS(s, t);
  sort(res.begin(), res.end());
  printf("%d\n", (int)res.size());
  for (int i = 0; i < (int)res.size(); i++)
    printf("%d %d\n", res[i].first, res[i].second);
}
