#include <bits/stdc++.h>
const int INF = 1 << 30;
int bsearch(const std::vector<int> &part, int lo, int hi, int t) {
  auto serve_before_lo = part[lo - 1];
  auto poz = INF;
  while (lo <= hi) {
    auto mid = lo + (hi - lo) / 2;
    auto serve_cur = part[mid] - serve_before_lo;
    if (serve_cur > t)
      hi = mid - 1;
    else if (serve_cur < t)
      lo = mid + 1;
    else {
      poz = mid;
      hi = mid - 1;
    }
  }
  return poz;
}
int main() {
  std::ios_base::sync_with_stdio(true);
  int N;
  std::cin >> N;
  std::vector<int> v(N + 1);
  for (auto i = 1; i <= N; ++i) std::cin >> v[i];
  std::vector<int> part_1(N + 1, 0);
  std::vector<int> part_2(N + 1, 0);
  for (auto i = 1; i <= N; ++i) {
    if (v[i] == 1) {
      part_1[i] = part_1[i - 1] + 1;
      part_2[i] = part_2[i - 1];
    } else {
      part_2[i] = part_2[i - 1] + 1;
      part_1[i] = part_1[i - 1];
    }
  }
  std::vector<std::pair<int, int>> result;
  for (auto i = 1; i <= N; ++i) {
    auto pl1_total = 0;
    auto pl2_total = 0;
    auto curr_start = 1;
    while (true) {
      auto pl1_first = bsearch(part_1, curr_start, N, i);
      auto pl2_first = bsearch(part_2, curr_start, N, i);
      if (pl1_first == INF && pl2_first == INF) break;
      if (pl1_first < pl2_first)
        ++pl1_total;
      else
        ++pl2_total;
      curr_start = std::min(pl1_first, pl2_first);
      if (curr_start == N) {
        if (pl1_total == pl2_total) break;
        if ((pl1_total < pl2_total && v[N] == 2) ||
            (pl1_total > pl2_total && v[N] == 1))
          result.emplace_back(std::max(pl1_total, pl2_total), i);
        break;
      }
      ++curr_start;
    }
  }
  std::cout << result.size() << std::endl;
  std::sort(result.begin(), result.end());
  for (auto &i : result) std::cout << i.first << " " << i.second << std::endl;
  return 0;
}
