#include <bits/stdc++.h>
using namespace std;
int n, arr[100001], CumulatieOne[100001], CumulativeTwo[100001];
vector<pair<int, int> > v;
pair<int, int> Find_Lowest_Occur(int SetPoint, int StartIndex) {
  pair<int, int> ret;
  int low = StartIndex, high = n, mid, One = 9000000, Two = 9000000;
  while (low <= high) {
    mid = (low + high) / 2;
    if (CumulatieOne[mid] - CumulatieOne[StartIndex - 1] >= SetPoint) {
      One = min(One, mid);
      high = mid - 1;
    } else
      low = mid + 1;
  }
  low = StartIndex, high = n;
  while (low <= high) {
    mid = (low + high) / 2;
    if (CumulativeTwo[mid] - CumulativeTwo[StartIndex - 1] >= SetPoint) {
      Two = min(Two, mid);
      high = mid - 1;
    } else
      low = mid + 1;
  }
  if (min(One, Two) > 100001) return make_pair(-1, n);
  if (One < Two) return make_pair(1, One);
  return make_pair(2, Two);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 1; i <= n; i++) {
    CumulatieOne[i] = CumulatieOne[i - 1] + (arr[i] == 1);
    CumulativeTwo[i] = CumulativeTwo[i - 1] + (arr[i] == 2);
  }
  int LastIndex = 0;
  for (int j = 1; j <= n; j++) {
    int One_Win_Serve = 0, Two_Win_Serve = 0;
    for (int i = 1; i <= n;) {
      pair<int, int> temp;
      temp = Find_Lowest_Occur(j, i);
      if (temp.first < 0) break;
      if (temp.first == 1) One_Win_Serve++;
      if (temp.first == 2) Two_Win_Serve++;
      if (temp.second == n && temp.first == 1 &&
          One_Win_Serve > Two_Win_Serve) {
        LastIndex = max(LastIndex, temp.second);
        v.push_back(make_pair(One_Win_Serve, j));
      }
      if (temp.second == n && temp.first == 2 &&
          Two_Win_Serve > One_Win_Serve) {
        LastIndex = max(LastIndex, temp.second);
        v.push_back(make_pair(Two_Win_Serve, j));
      }
      i = temp.second + 1;
    }
  }
  if (LastIndex != n) v.clear();
  sort(v.begin(), v.end());
  cout << (int)v.size() << endl;
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
  return 0;
}
