#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void Int(T &n) {
  n = 0;
  int f = 1;
  register int ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
template <typename T>
T gcd(T a, T b) {
  return !b ? a : gcd(b, a % b);
}
template <typename T>
inline void umin(T &a, T b) {
  a = a < b ? a : b;
}
template <typename T>
inline void umax(T &a, T b) {
  a = a > b ? a : b;
}
template <typename T, typename W>
inline void Int(T &x, W &y) {
  Int(x), Int(y);
}
template <typename T, typename W, typename Q>
inline void Int(T &x, W &y, Q &z) {
  Int(x, y), Int(z);
}
const int N = 2e5 + 7;
const int inf = 1e9 + 7;
set<int> T[3];
set<pair<int, int> > res;
int n, p[N], pre[3][N], suf[3][N], idx[3][N];
void calc(int id) {
  for (int t : T[id]) {
    vector<int> win(3);
    int i, lastWinner = -1;
    for (i = 1; i <= n;) {
      int nxt1 = idx[id][pre[id][i - 1] + t];
      int nxt2 = idx[3 - id][pre[3 - id][i - 1] + t];
      if (nxt1 == -1 and nxt2 == -1)
        break;
      else if (nxt1 == -1) {
        i = nxt2 + 1;
        lastWinner = 3 - id;
      } else if (nxt2 == -1) {
        i = nxt1 + 1;
        lastWinner = id;
      } else if (nxt1 > nxt2) {
        i = nxt2 + 1;
        lastWinner = 3 - id;
      } else if (nxt1 < nxt2) {
        i = nxt1 + 1;
        lastWinner = id;
      }
      ++win[lastWinner];
    }
    if (lastWinner == id and win[id] > win[3 - id] and i > n) {
      res.insert({win[id], t});
    }
  }
}
int solve() {
  Int(n);
  for (int i = 1; i <= n; ++i) {
    Int(p[i]);
    if (p[i] == 1) pre[1][i] = suf[1][i] = 1;
    if (p[i] == 2) pre[2][i] = suf[2][i] = 1;
  }
  memset(idx, -1, sizeof idx);
  for (int i = 1; i <= n; ++i) {
    pre[1][i] += pre[1][i - 1];
    pre[2][i] += pre[2][i - 1];
    if (idx[1][pre[1][i]] == -1) idx[1][pre[1][i]] = i;
    if (idx[2][pre[2][i]] == -1) idx[2][pre[2][i]] = i;
  }
  for (int i = n; i >= 1; --i) {
    suf[1][i] += suf[1][i + 1];
    suf[2][i] += suf[2][i + 1];
    if (suf[1][i] > suf[2][i]) T[1].insert(suf[1][i]);
    if (suf[1][i] < suf[2][i]) T[2].insert(suf[2][i]);
  }
  calc(1), calc(2);
  printf("%d\n", (int)res.size());
  for (auto i : res) printf("%d %d\n", i.first, i.second);
  return 0;
}
int main() {
  int tests = 1, CaseNo = 0;
  while (tests--) {
    solve();
  }
  return 0;
}
