#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
template <typename It>
void make_fenwick(It beg, size_t n) {
  for (size_t i = 0; i < n; i++) {
    size_t p = i | (i + 1);
    if (p < n) beg[p] += beg[i];
  }
}
template <typename It, typename Val>
void add_fenwick(It beg, size_t n, size_t i, Val val) {
  for (; i < n; i |= i + 1) beg[i] += val;
}
template <typename It, typename Val>
Val sum_fenwick(It beg, size_t i, Val sum) {
  for (; i > 0; i = i & (i - 1)) sum += beg[i - 1];
  return sum;
}
template <typename It>
typename std::iterator_traits<It>::value_type sum_fenwick(It beg, size_t i) {
  return sum_fenwick(beg, i, typename std::iterator_traits<It>::value_type());
}
size_t highestOneBit(size_t v) {
  v |= v >> 1;
  v |= v >> 2;
  v |= v >> 4;
  v |= v >> 8;
  v |= v >> 16;
  return (v >> 1) + 1;
}
template <typename It, typename Val, typename Cmp>
size_t search_fenwick(It beg, size_t n, Val val, Val left, Cmp cmp) {
  if (!cmp(left, val)) return 0;
  size_t i = 0;
  for (size_t w = highestOneBit(n); w > 0; w >>= 1) {
    if (i + w <= n) {
      Val mid = left;
      mid += beg[i + w - 1];
      if (cmp(mid, val)) {
        i += w;
        left = mid;
      }
    }
  }
  return i + 1;
}
template <typename It, typename Val>
size_t lower_bound_fenwick(It beg, size_t n, Val val) {
  return search_fenwick(beg, n, val, Val(), std::less<Val>());
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int(i) = 0; (i) < (int)(n); ++(i)) scanf("%d", &a[i]);
  vector<int> x(n), y(n);
  for (int(i) = 0; (i) < (int)(n); ++(i)) {
    x[i] = a[i] == 1;
    y[i] = a[i] == 2;
  }
  make_fenwick(x.begin(), n);
  make_fenwick(y.begin(), n);
  vector<pair<int, int> > ans;
  for (int(s) = (int)(1); (s) <= (int)(n); ++(s)) {
    int i = 0, xt = 0, yt = 0, last = -1;
    bool ok = true;
    while (i < n) {
      int xs = sum_fenwick(x.begin(), i);
      int ys = sum_fenwick(y.begin(), i);
      int xj = lower_bound_fenwick(x.begin(), n, xs + s) - 1;
      int yj = lower_bound_fenwick(y.begin(), n, ys + s) - 1;
      if (xj < yj) {
        ++xt;
        last = 1;
        i = xj + 1;
      } else if (yj < xj) {
        ++yt;
        last = 2;
        i = yj + 1;
      } else {
        ok = false;
        break;
      }
    }
    if (last == 1) {
      ok &= xt > yt;
    } else if (last == 2) {
      ok &= yt > xt;
    }
    if (ok) ans.push_back(make_pair((max(xt, yt)), (s)));
  }
  sort((ans).begin(), (ans).end());
  printf("%d\n", (int)ans.size());
  for (typeof((ans).begin()) i = ((ans).begin()); i != (ans).end(); ++i)
    printf("%d %d\n", i->first, i->second);
  return 0;
}
