#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int a[n], cnt1 = 0, cnt2 = 0, idx1[n + 2], idx2[n + 2], _cnt1[n + 2],
            _cnt2[n + 2];
  for (int i = 1; i <= n + 1; i++) {
    idx1[i] = n + 1, idx2[i] = n + 1;
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 1) {
      cnt1++;
      idx1[cnt1] = i;
      _cnt1[i] = (i == 0 ? 0 : _cnt1[i - 1]) + 1;
      _cnt2[i] = (i == 0 ? 0 : _cnt2[i - 1]);
    } else {
      cnt2++;
      idx2[cnt2] = i;
      _cnt1[i] = (i == 0 ? 0 : _cnt1[i - 1]);
      _cnt2[i] = (i == 0 ? 0 : _cnt2[i - 1]) + 1;
    }
  }
  set<pair<int, int> > ans;
  for (int i = 1; i <= n; i++) {
    int ptr1 = i, ptr2 = i, last = -1, win1 = 0, win2 = 0, check;
    while (idx1[ptr1] < n || idx2[ptr2] < n) {
      last = max(last, min(idx1[ptr1], idx2[ptr2]));
      if (idx1[ptr1] < idx2[ptr2]) {
        win1++;
        check = 1;
        ptr2 = _cnt2[idx1[ptr1]] + i;
        ptr1 += i;
      } else {
        win2++;
        check = 2;
        ptr1 = _cnt1[idx2[ptr2]] + i;
        ptr2 += i;
      }
      ptr1 = min(ptr1, n + 1);
      ptr2 = min(ptr2, n + 1);
    }
    if (last == n - 1) {
      if (win1 != win2 && (win1 < win2 ? check == 2 : check == 1)) {
        ans.insert({max(win2, win1), i});
      }
    }
  }
  cout << ans.size() << '\n';
  for (auto &i : ans) {
    cout << i.first << ' ' << i.second << '\n';
  }
}
