#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (1) {
    a = a % b;
    if (a == 0) return b;
    b = b % a;
    if (b == 0) return a;
  }
}
const int inf = 1e9;
int a1[1000 * 1000 + 100];
int a2[1000 * 1000 + 100];
int b1[1000 * 1000 + 100], b2[1000 * 1000 + 100];
set<pair<int, int> > ans;
int main() {
  int n;
  cin >> n;
  int b;
  for (int i = 0; i < 1000 * 1000; i++) {
    a1[i] = inf;
    a2[i] = inf;
  }
  memset(b1, 0, sizeof b1);
  memset(b2, 0, sizeof b2);
  int x = 0, y = 0;
  for (int i = 0; i < n; i++) {
    cin >> b;
    if (b == 1) {
      x++;
      a1[x] = i;
    } else {
      y++;
      a2[y] = i;
    }
    b1[i] = x;
    b2[i] = y;
  }
  for (int i = 1; i <= n; i++) {
    bool cor = true;
    int p1 = 0, p2 = 0;
    int s1 = 0, s2 = 0;
    while (true) {
      if (a1[p1 + i] == inf && a2[p2 + i] == inf) {
        break;
      }
      if (a1[p1 + i] < a2[p2 + i]) {
        s1++;
        p1 += i;
        p2 = b2[a1[p1]];
      } else if (a1[p1 + i] > a2[p2 + i]) {
        s2++;
        p2 += i;
        p1 = b1[a2[p2]];
      }
    }
    if (p1 + p2 == n) {
      if (s1 > s2 && b == 1) {
        ans.insert(make_pair(s1, i));
      } else if (s1 < s2 && b == 2) {
        ans.insert(make_pair(s2, i));
      }
    }
  }
  cout << ans.size() << endl;
  int tmp = ans.size();
  for (int i = 0; i < tmp; i++) {
    cout << ans.begin()->first << " " << ans.begin()->second << endl;
    ans.erase(ans.begin());
  }
  return 0;
}
