#include <bits/stdc++.h>
const int N = 200005;
using namespace std;
int a[N], posX[N], posY[N], reachX[N], reachY[N];
pair<int, int> s[N];
vector<pair<int, int> > ans;
int n;
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = (1); i <= (n); i++) {
    cin >> a[i];
    s[i] = s[i - 1];
    if (a[i] == 1)
      s[i].first++;
    else
      s[i].second++;
  }
  memset(posX, -1, sizeof posX);
  memset(posY, -1, sizeof posY);
  for (int i = (1); i <= (n); i++) {
    if (posX[s[i].first] == -1) posX[s[i].first] = i;
    if (posY[s[i].second] == -1) posY[s[i].second] = i;
  }
  for (int t = (1); t <= (n); t++) {
    int px = 0, py = 0, setX = 0, setY = 0;
    bool ok = 1;
    int lastWin;
    while (1) {
      int nextX = posX[s[px].first + t], nextY = posY[s[py].second + t];
      if (nextX == -1 && nextY == -1) {
        ok = 0;
        break;
      }
      if (nextY == -1 || (nextX > 0 && nextX < nextY)) {
        setX++;
        px = py = nextX;
        reachX[setX] = px;
      } else {
        setY++;
        px = py = nextY;
        reachY[setY] = py;
      }
      if (px == n) break;
    }
    if (ok) {
      if (setX != setY) {
        if (setX < setY && reachY[setY] != n) {
          for (int i = (0); i <= (setX); i++) reachX[i] = 0;
          for (int i = (0); i <= (setY); i++) reachY[i] = 0;
          continue;
        }
        if (setY < setX && reachX[setX] != n) {
          for (int i = (0); i <= (setX); i++) reachX[i] = 0;
          for (int i = (0); i <= (setY); i++) reachY[i] = 0;
          continue;
        }
        for (int i = (0); i <= (setX); i++) reachX[i] = 0;
        for (int i = (0); i <= (setY); i++) reachY[i] = 0;
        ans.push_back(make_pair(max(setX, setY), t));
      }
    }
  }
  sort((ans).begin(), (ans).end());
  cout << (int((ans).size())) << '\n';
  for (typeof((ans).begin()) it = (ans).begin(); it != (ans).end(); it++)
    cout << (it->first) << ' ' << (it->second) << '\n';
  return 0;
}
