#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int MAX = 1e9 + 5;
int i, j, w1, w2, k, n, m, a[N], b[N], calca[N], calcb[N], temp;
vector<pair<int, int> > ans, adasd;
bool ctr(int s) {
  int set = 0;
  int p1 = 0;
  int p2 = 0;
  int last1 = 0;
  int last2 = 0;
  int lastt = 0;
  while (1) {
    if (w1 == last1 && w2 == last2)
      if (((p1 > p2 && lastt == 1) || (p2 > p1 && lastt == 2)) && p1 != p2) {
        temp = max(p1, p2);
        return true;
      } else
        return false;
    if (last2 + s <= w2 && b[last2 + s] < a[last1 + s]) {
      p2++;
      lastt = 2;
      last2 += s;
      last1 = lower_bound(a + 1, a + w1 + 1, b[last2]) - a - 1;
    } else if (last1 + s <= w1 && a[last1 + s] < b[last2 + s]) {
      p1++;
      lastt = 1;
      last1 += s;
      last2 = lower_bound(b + 1, b + w2 + 1, a[last1]) - b - 1;
    } else
      return false;
  }
}
int main() {
  cin >> n;
  int asdasdasda;
  for (int i = 1; i <= 200001; i++) a[i] = b[i] = 100000000;
  int x;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    if (x == 1)
      a[++w1] = i;
    else
      b[++w2] = i;
  }
  for (int i = 1; i <= n; i++)
    if (ctr(i)) ans.push_back(make_pair(temp, i));
  sort(ans.begin(), ans.end());
  cout << ans.size() << '\n';
  for (int i = 0; i <= (int)ans.size() - 1; i++)
    cout << ans[i].first << ' ' << ans[i].second << '\n';
  return 0;
}
