#include <bits/stdc++.h>
using namespace std;
int n;
int input[100000];
int prefix1[100001];
int prefix2[100001];
int precise1[100001];
int precise2[100001];
int main() {
  std::ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> input[i];
  for (int i = 0; i < n; ++i)
    if (input[i] == 1)
      prefix1[i + 1] = prefix1[i] + 1;
    else
      prefix1[i + 1] = prefix1[i];
  for (int i = 0; i < n; ++i)
    if (input[i] == 2)
      prefix2[i + 1] = prefix2[i] + 1;
    else
      prefix2[i + 1] = prefix2[i];
  for (int i = 0; i <= 100000; ++i) precise1[i] = precise2[i] = -1;
  for (int i = 0; i <= n; ++i)
    if (precise1[prefix1[i]] == -1) precise1[prefix1[i]] = i;
  for (int i = 0; i <= n; ++i)
    if (precise2[prefix2[i]] == -1) precise2[prefix2[i]] = i;
  vector<pair<int, int>> answers;
  stack<pair<int, int>> buffer;
  for (int t = n; t >= 1; --t) {
    int last_finished_round = 0;
    int first_done_sets = 0;
    int second_done_sets = 0;
    while (last_finished_round < n) {
      const int first_must_have = prefix1[last_finished_round] + t;
      const int second_must_have = prefix2[last_finished_round] + t;
      int who = 0;
      int new_finished_round = -1;
      if (first_must_have > n && second_must_have > n)
        who = 0, new_finished_round = -1;
      else if (first_must_have > n)
        who = 2, new_finished_round = precise2[second_must_have];
      else if (second_must_have > n)
        who = 1, new_finished_round = precise1[first_must_have];
      else if (precise1[first_must_have] == -1 &&
               precise2[second_must_have] == -1)
        who = 0, new_finished_round = -1;
      else if (precise1[first_must_have] == -1)
        who = 2, new_finished_round = precise2[second_must_have];
      else if (precise2[second_must_have] == -1)
        who = 1, new_finished_round = precise1[first_must_have];
      else if (precise1[first_must_have] < precise2[second_must_have])
        who = 1, new_finished_round = precise1[first_must_have];
      else if (precise1[first_must_have] > precise2[second_must_have])
        who = 2, new_finished_round = precise2[second_must_have];
      else
        assert(false);
      if (who == 1 && new_finished_round != -1)
        first_done_sets++, last_finished_round = new_finished_round;
      else if (who == 2 && new_finished_round != -1)
        second_done_sets++, last_finished_round = new_finished_round;
      else
        break;
    }
    if (last_finished_round == n) {
      if (first_done_sets > second_done_sets && input[n - 1] == 1) {
        if (!buffer.empty() && buffer.top().second == first_done_sets)
          buffer.emplace(t, first_done_sets);
        else {
          while (!buffer.empty())
            answers.emplace_back(buffer.top()), buffer.pop();
          buffer.emplace(t, first_done_sets);
        }
      } else if (first_done_sets < second_done_sets && input[n - 1] == 2) {
        if (!buffer.empty() && buffer.top().second == second_done_sets)
          buffer.emplace(t, second_done_sets);
        else {
          while (!buffer.empty())
            answers.emplace_back(buffer.top()), buffer.pop();
          buffer.emplace(t, second_done_sets);
        }
      }
    }
  }
  while (!buffer.empty()) answers.emplace_back(buffer.top()), buffer.pop();
  cout << answers.size() << endl;
  for (const pair<int, int>& p : answers)
    cout << p.second << " " << p.first << "\n";
  return 0;
}
