#include <bits/stdc++.h>
using namespace std;
void printArr(int a[], int lo, int hi) {
  for (int i = lo; i <= hi; ++i) {
    printf("%d ", a[i]);
  }
  printf("\n");
}
int N;
int A[100 * 1000 + 10];
int Ans[100 * 1000 + 10][2];
int K;
int S[2][100 * 1000 + 10];
const int INF = 1 << 30;
int next(int lo, int hi, int c, int val) {
  hi = min(hi, N);
  int *s = S[val - 1];
  int b = s[lo - 1];
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    int x = s[mid] - b;
    if (x >= c)
      hi = mid;
    else
      lo = mid + 1;
  }
  if (s[lo] - b == c)
    return lo;
  else
    return INF;
}
void buildS() {
  for (int i = 1; i <= N; ++i) {
    S[0][i] = S[0][i - 1] + (A[i] == 1);
    S[1][i] = S[1][i - 1] + (A[i] == 2);
  }
}
vector<pair<int, int> > v;
void readData() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", A + i);
  }
}
void readBigData() {
  N = 1 << 16;
  for (int i = 1; i <= N; ++i) {
    A[i] = 1;
  }
}
void solve() {
  readData();
  buildS();
  for (int s = 1; s <= N; ++s) {
    bool ok = true;
    int mx = s + s - 1;
    int p = 1;
    int c1 = 0, c2 = 0;
    int last = -1;
    while (true) {
      int p1 = next(p, p + mx - 1, s, 1);
      int p2 = next(p, p + mx - 1, s, 2);
      if (p1 == INF && p2 == INF) {
        ok = false;
        break;
      }
      if (p1 < p2) {
        p = p1 + 1;
        ++c1;
        last = 1;
      } else {
        p = p2 + 1;
        ++c2;
        last = 2;
      }
      if (p1 == N || p2 == N) break;
    }
    if (c1 == c2) {
      ok = false;
    }
    if (c1 > c2 && last != 1) ok = false;
    if (c1 < c2 && last != 2) ok = false;
    if (ok) {
      int c = max(c1, c2);
      v.push_back(make_pair(c, s));
    }
  }
  int K = v.size();
  printf("%d\n", K);
  sort(v.begin(), v.end());
  for (int i = 0; i < K; ++i) {
    printf("%d %d\n", v[i].first, v[i].second);
  }
}
void test() {}
int main() {
  solve();
  return 0;
}
