#include <bits/stdc++.h>
using namespace std;
const int maxN = 100005;
int n, x, idx1, idx2;
pair<int, int> fromOne, fromTwo;
vector<pair<int, int>> answer;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  pair<int, int> first[n + 1], second[n + 1];
  first[0] = second[0] = make_pair(0, 0);
  for (int i = 1; i <= n; ++i) {
    cin >> x;
    first[i].first = (x == 1) + first[i - 1].first;
    first[i].second = (x == 2) + first[i - 1].second;
    second[i] = make_pair(first[i].second, first[i].first);
  }
  for (int t = 1; t <= n; ++t) {
    int cur = 0;
    int lastWinner = -1;
    int one = 0;
    int two = 0;
    while (cur < n) {
      fromOne = make_pair(first[cur].first + t, first[cur].second);
      fromTwo = make_pair(second[cur].first + t, second[cur].second);
      idx1 = lower_bound(first + 1, first + n + 1, fromOne) - first;
      idx2 = lower_bound(second + 1, second + 1 + n, fromTwo) - second;
      if (idx1 < idx2) {
        cur = idx1;
        lastWinner = 1;
        one++;
      } else {
        cur = idx2;
        lastWinner = 0;
        two++;
      }
    }
    if (one != two && one > two == lastWinner && cur == n) {
      answer.push_back(make_pair(max(one, two), t));
    }
  }
  sort(answer.begin(), answer.end());
  cout << answer.size() << endl;
  for (pair<int, int> p : answer) {
    cout << p.first << " " << p.second << endl;
  }
  return 0;
}
