#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i]--;
  }
  if (a[n - 1] == 1) {
    for (int i = 0; i < n; i++) a[i] = abs(a[i] - 1);
  }
  vector<int> f(n, 0), s(n, 0);
  if (a[0] == 0)
    f[0]++;
  else
    s[0]++;
  for (int i = 1; i < n; i++) {
    f[i] = f[i - 1];
    s[i] = s[i - 1];
    if (a[i] == 0)
      f[i]++;
    else
      s[i]++;
  }
  vector<pair<int, int> > ans;
  for (int t = 1; t <= n; t++) {
    int sc1 = 0, sc2 = 0;
    int pos = -1;
    int st1 = 0, st2 = 0;
    while (pos < n) {
      int l = min(pos + t, n - 1);
      int r = min(pos + 2 * t, n - 1);
      int x;
      if (pos == -1)
        x = t;
      else
        x = f[pos] + t;
      while (r - l > 1) {
        int k = (r + l) / 2;
        if (f[k] >= x) {
          r = k;
        } else {
          l = k;
        }
      }
      int a1 = 9999999;
      if (f[r] == x) {
        a1 = r;
      }
      if (f[l] == x) {
        a1 = l;
      }
      l = min(pos + t, n - 1);
      r = min(pos + 2 * t, n - 1);
      if (pos == -1)
        x = t;
      else
        x = s[pos] + t;
      while (r - l > 1) {
        int k = (r + l) / 2;
        if (s[k] >= x) {
          r = k;
        } else {
          l = k;
        }
      }
      int a2 = 9999999;
      if (s[r] == x) {
        a2 = r;
      }
      if (s[l] == x) {
        a2 = l;
      }
      if (a1 < a2) {
        pos = a1;
        sc1++;
      } else {
        pos = a2;
        sc2++;
      }
      if (pos == n - 1) {
        pos++;
        if (sc1 > sc2) {
          ans.push_back(make_pair(sc1, t));
        }
      }
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}
