#include <bits/stdc++.h>
using namespace std;
int n, m, winner;
int pointA[100000 + 50];
int pointB[100000 + 50];
int findIndex(int *arr, int value, int pos);
vector<pair<int, int> > ans;
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  return a.first < b.first;
}
int main() {
  memset(pointA, 0, sizeof(pointA));
  memset(pointB, 0, sizeof(pointB));
  scanf("%d", &(n));
  for (int i = 0; i < n; i++) {
    int tmp;
    scanf("%d", &(tmp));
    pointA[i + 1] = pointA[i] + (tmp == 1);
    pointB[i + 1] = pointB[i] + (tmp == 2);
    if (i == n - 1) {
      winner = tmp;
    }
  }
  for (int i = 1; i <= n; ++i) {
    int winA = 0, winB = 0, cur = 0;
    int posA, posB;
    while (cur < n) {
      posA = (lower_bound(pointA + cur + 1, pointA + n + 1, i + pointA[cur]) -
              pointA);
      posB = (lower_bound(pointB + cur + 1, pointB + n + 1, i + pointB[cur]) -
              pointB);
      if (posA > posB) {
        cur = posB;
        winB++;
      } else if (posA < posB) {
        cur = posA;
        winA++;
      } else {
        winA = 0, winB = 0;
        break;
      }
    }
    if (winner == 1) {
      if (winA > winB) {
        ans.push_back(make_pair(winA, i));
      }
    } else {
      if (winB > winA) {
        ans.push_back(make_pair(winB, i));
      }
    }
  }
  sort(ans.begin(), ans.end(), cmp);
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
