#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  int a[n];
  for (int &x : a) cin >> x;
  vector<int> A(n);
  vector<int> B(n);
  for (int i = 0; i < n; i++) {
    A[i] = a[i] == 1 ? 1 : 0;
    B[i] = a[i] == 2 ? 1 : 0;
    if (i) A[i] += A[i - 1], B[i] += B[i - 1];
  }
  vector<pair<int, int>> ans;
  for (int t = 1; t <= n; t++) {
    int s1 = 0;
    int s2 = 0;
    int scoreA = 0;
    int scoreB = 0;
    vector<pair<int, int>> intervalA;
    vector<pair<int, int>> intervalB;
    int lstA = 0, lstB = 0;
    bool reach = false;
    for (int targetA = t, targetB = t; targetA <= n || targetB <= n;) {
      int start = 0, end = n - 1, idxA = -1, idxB = -1;
      while (start <= end) {
        int mid = start + end >> 1;
        if (A[mid] == targetA) idxA = mid;
        if (A[mid] >= targetA)
          end = mid - 1;
        else
          start = mid + 1;
      }
      start = 0, end = n - 1;
      while (start <= end) {
        int mid = start + end >> 1;
        if (B[mid] == targetB) idxB = mid;
        if (B[mid] >= targetB)
          end = mid - 1;
        else
          start = mid + 1;
      }
      if (idxA != -1 && idxA < idxB)
        targetA = A[idxA] + t, targetB = B[idxA] + t,
        intervalA.push_back({targetA, idxA});
      else if (idxB != -1 && idxB < idxA)
        targetB = B[idxB] + t, targetA = A[idxB] + t,
        intervalB.push_back({targetB, idxB});
      else if (idxA == -1 && idxB != -1)
        targetB = B[idxB] + t, targetA = A[idxB] + t,
        intervalB.push_back({targetB, idxB});
      else if (idxA != -1 && idxB == -1)
        targetA = A[idxA] + t, targetB = B[idxA] + t,
        intervalA.push_back({targetA, idxA});
      else
        break;
    }
    sort(intervalA.begin(), intervalA.end());
    sort(intervalB.begin(), intervalB.end());
    int ptr[2];
    ptr[0] = ptr[1] = 0;
    while (ptr[0] < intervalA.size() || ptr[1] < intervalB.size()) {
      int idxA =
          ptr[0] < intervalA.size() ? intervalA[ptr[0]].second : (1 << 30);
      int idxB =
          ptr[1] < intervalB.size() ? intervalB[ptr[1]].second : (1 << 30);
      if (idxA < idxB) {
        scoreA = A[idxA] - lstA, scoreB = B[idxA] - lstB, ptr[0]++;
        lstA = A[idxA];
        lstB = B[idxA];
      } else {
        scoreA = A[idxB] - lstA, scoreB = B[idxB] - lstB, ptr[1]++;
        lstA = A[idxB];
        lstB = B[idxB];
      }
      if (scoreA == t)
        s1++, reach |= idxA == n - 1 && s1 > s2;
      else if (scoreB == t)
        s2++, reach |= idxB == n - 1 && s2 > s1;
    }
    if (reach && s1 != s2) ans.push_back({max(s1, s2), t});
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << '\n';
  for (auto &p : ans) cout << p.first << ' ' << p.second << '\n';
  return 0;
}
