#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool getmin(T *a, const T &b) {
  if (b < *a) {
    *a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool getmax(T *a, const T &b) {
  if (b > *a) {
    *a = b;
    return true;
  }
  return false;
}
template <class T>
inline void read(T *a) {
  char c;
  while (isspace(c = getchar())) {
  }
  bool flag = 0;
  if (c == '-')
    flag = 1, *a = 0;
  else
    *a = c - 48;
  while (isdigit(c = getchar())) *a = *a * 10 + c - 48;
  if (flag) *a = -*a;
}
const int mo = 1000000007;
template <class T>
T pow(T a, T b, int c = mo) {
  T res = 1;
  for (T i = 1; i <= b; i <<= 1, a = 1LL * a * a % c)
    if (b & i) res = 1LL * res * a % c;
  return res;
}
const int N = 100100;
int n;
int a[N];
int s1[N], s2[N];
pair<int, int> ans[N];
int check(int x) {
  int j = 0, i = 1, num1 = 0, num2 = 0, last = 0;
  while (i <= n) {
    int l = i, r = n, res = 0;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (max(s1[mid] - s1[j], s2[mid] - s2[j]) >= x)
        res = mid, r = mid - 1;
      else
        l = mid + 1;
    }
    if (!res) return 0;
    if (s1[res] - s1[j] == x)
      ++num1, last = 1;
    else
      ++num2, last = 2;
    j = res, i = res + 1;
  }
  if (num1 > num2 && last == 1)
    return num1;
  else if (num2 > num1 && last == 2)
    return num2;
  return 0;
}
int main() {
  cin >> n;
  for (int i = (1); i <= (n); ++i) {
    read(a + i);
    s1[i] = s1[i - 1] + (a[i] == 1);
    s2[i] = s2[i - 1] + (a[i] == 2);
  }
  int m = 0;
  for (int i = (1); i <= (n); ++i) {
    int z = check(i);
    if (z) ans[++m] = std::make_pair(z, i);
  }
  sort(ans + 1, ans + m + 1);
  cout << m << endl;
  for (int i = (1); i <= (m); ++i)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
