#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9;
const int MOD = 1e9 + 7;
const int N = 1e5 + 10;
int n, a[N], x, y;
vector<pair<int, int> > s[2][N], ans;
pair<int, int> p[N];
bool comp(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first < b.first;
}
void prepare() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  if (a[n] == 2) {
    for (int i = 1; i <= n; i++)
      if (a[i] == 1)
        a[i] = 2;
      else
        a[i] = 1;
  }
  s[0][0].push_back(pair<int, int>(0, 0));
  s[1][0].push_back(pair<int, int>(0, 0));
  x = 0, y = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 1)
      x++;
    else
      y++;
    p[i] = pair<int, int>(x, y);
    s[0][x].push_back(pair<int, int>(y, i));
    s[1][y].push_back(pair<int, int>(x, i));
  }
}
void DFS(int point, int x, int win, int loss) {
  if (x == 0) {
    if (win > loss) ans.push_back(pair<int, int>(win, point));
    return;
  }
  int cur;
  if (a[x] == 1) {
    cur = p[x].first - point;
    if (cur >= 0)
      for (vector<pair<int, int> >::reverse_iterator i = s[0][cur].rbegin();
           i < s[0][cur].rend(); i++) {
        if (p[x].second - i->first >= point) break;
        DFS(point, i->second, win + 1, loss);
      }
  } else {
    cur = p[x].second - point;
    if (cur >= 0)
      for (vector<pair<int, int> >::reverse_iterator i = s[1][cur].rbegin();
           i < s[1][cur].rend(); i++) {
        if (p[x].first - i->first >= point) break;
        DFS(point, i->second, win, loss + 1);
      }
  }
}
int main() {
  prepare();
  for (int t = 1; t <= n; t++) DFS(t, n, 0, 0);
  if (!ans.empty()) sort(ans.begin(), ans.end(), comp);
  printf("%d\n", ans.size());
  for (auto &i : ans) printf("%d %d\n", i.first, i.second);
}
