#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& _p) {
  return os << "(" << _p.first << "," << _p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& _V) {
  bool f = true;
  os << "[";
  for (auto v : _V) {
    os << (f ? "" : ",") << v;
    f = false;
  }
  return os << "]";
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& _S) {
  bool f = true;
  os << "(";
  for (auto s : _S) {
    os << (f ? "" : ",") << s;
    f = false;
  }
  return os << ")";
}
template <typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& _M) {
  return os << set<pair<T, U>>(_M.begin(), _M.end());
}
const signed long long INF = 1000000100;
const long double EPS = 1e-9;
template <typename T, typename F>
T bin_search(T a, T b, F f) {
  while (a < b) {
    T c = a + (b - a) / 2;
    if (f(c)) {
      b = c;
    } else {
      a = c + 1;
    }
  }
  return a;
}
const int MAXN = 1000100;
int A[MAXN];
int S1[MAXN];
int S2[MAXN];
int N;
void read_data() {
  scanf("%d", &N);
  for (int(i) = (1); (i) <= (N); (i)++) scanf("%d", A + i);
}
void solve() {
  vector<pair<int, int>> results;
  for (int(i) = (1); (i) <= (N); (i)++) S1[i] = S1[i - 1] + (A[i] == 1);
  for (int(i) = (1); (i) <= (N); (i)++) S2[i] = S2[i - 1] + (A[i] == 2);
  for (int(i) = (N); (i) >= (1); (i)--) {
    int t = 0;
    int z1 = 0;
    int z2 = 0;
    bool fail = false;
    int last = -1;
    while (t < N) {
      int k1 = bin_search(t + 1, N + 1, [&](int x) {
        return x == N + 1 or S1[x] - S1[t] >= i;
      });
      int k2 = bin_search(t + 1, N + 1, [&](int x) {
        return x == N + 1 or S2[x] - S2[t] >= i;
      });
      if (k1 < k2) {
        if (S1[k1] - S1[t] != i) {
          fail = true;
          break;
        }
        ++z1;
        last = 1;
      } else if (k1 > k2) {
        if (S2[k2] - S2[t] != i) {
          fail = true;
          break;
        }
        ++z2;
        last = 2;
      } else
        fail = true;
      t = min(k1, k2);
    }
    if (z1 > z2 and last != 1) continue;
    if (z1 < z2 and last != 2) continue;
    if (fail) continue;
    if (z1 == z2) continue;
    results.emplace_back(max(z1, z2), i);
  }
  sort(results.begin(), results.end());
  printf("%d\n", int(results.size()));
  for (auto r : results) printf("%d %d\n", r.first, r.second);
}
int main() {
  read_data();
  solve();
}
