#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> winners = {-69};
  vector<int> p1 = {0};
  vector<int> p2 = {0};
  for (int i = 1; i <= n; i++) {
    int w;
    cin >> w;
    winners.push_back(w);
    p1.push_back(p1.back() + int(w == 1));
    p2.push_back(p2.back() + int(w == 2));
  }
  vector<pair<int, int>> ans;
  for (int t = 1; t <= n; t++) {
    int cur = 1;
    int one_wins = 0;
    int two_wins = 0;
    int last_win = -1;
    bool w = 1;
    while (cur <= n) {
      if (p1[n] - p1[cur - 1] < t && p2[n] - p2[cur - 1] < t) {
        w = 0;
        break;
      }
      int pass = n;
      int fail = cur - 1;
      while (pass - fail > 1) {
        int mid = int((pass + fail) / 2);
        if (p1[mid] - p1[cur - 1] >= t || p2[mid] - p2[cur - 1] >= t)
          pass = mid;
        else
          fail = mid;
      }
      if (p1[pass] - p1[cur - 1] == t) {
        one_wins++;
        last_win = 1;
      } else {
        two_wins++;
        last_win = 2;
      }
      cur = pass + 1;
    }
    if (w == 0) continue;
    if (one_wins > two_wins && last_win == 1) ans.push_back({one_wins, t});
    if (two_wins > one_wins && last_win == 2) ans.push_back({two_wins, t});
  }
  cout << ans.size() << endl;
  sort(ans.begin(), ans.end());
  for (auto a : ans) cout << a.first << " " << a.second << endl;
}
