#include <bits/stdc++.h>
using namespace std;
long long int n;
long long int arr[100005], p1[100005], p2[100005];
vector<pair<long long int, long long int> > ans;
bool comparison(const pair<long long int, long long int> &p1,
                const pair<long long int, long long int> &p2) {
  if (p1.first < p2.first) {
    return true;
  } else if (p1.first == p2.first) {
    return (p1.second < p2.second);
  }
  return false;
}
int main() {
  long long int i, j, k, a, b, c1, r, s, c2, ind1, ind2, ind, cnt1, cnt2, chk;
  pair<long long int, long long int> p;
  long long int *ptr1, *ptr2;
  cin >> n;
  for (i = 1; i <= n; ++i) {
    cin >> arr[i];
    if (arr[i] == 1) {
      p1[i] = 1 + p1[i - 1];
      p2[i] = p2[i - 1];
    } else {
      p1[i] = p1[i - 1];
      p2[i] = 1 + p2[i - 1];
    }
  }
  long long int last;
  for (i = 1; i <= n; ++i) {
    cnt1 = cnt2 = 0;
    chk = 0;
    c1 = i;
    c2 = i;
    a = 1;
    while (a <= n) {
      ind1 = ind2 = INT_MAX;
      ptr1 = lower_bound(p1 + a, p1 + n + 1, c1);
      r = ptr1 - p1;
      ptr2 = lower_bound(p2 + a, p2 + n + 1, c2);
      s = ptr2 - p2;
      if (p1[r] == c1) {
        ind1 = r;
      }
      if (p2[s] == c2) {
        ind2 = s;
      }
      ind = ind1 < ind2 ? ind1 : ind2;
      if (ind == n) {
        chk = 1;
      }
      if (ind != INT_MAX) {
        if (ind1 == ind) {
          cnt1++;
          last = 1;
        } else {
          cnt2++;
          last = 2;
        }
        c1 = p1[ind] + i;
        c2 = p2[ind] + i;
        a = ind + 1;
      } else {
        chk = 0;
        break;
      }
    }
    if (chk == 1 && cnt1 != cnt2) {
      if (cnt1 > cnt2 && last == 1) {
        p.first = cnt1 > cnt2 ? cnt1 : cnt2, p.second = i;
        ans.push_back(p);
      } else if (cnt1 < cnt2 && last == 2) {
        p.first = cnt1 > cnt2 ? cnt1 : cnt2, p.second = i;
        ans.push_back(p);
      }
    }
  }
  sort(ans.begin(), ans.end(), comparison);
  a = ans.size();
  cout << a << "\n";
  for (i = 0; i <= a - 1; ++i) {
    cout << ans[i].first << " " << ans[i].second << "\n";
  }
  return 0;
}
