#include <bits/stdc++.h>
using namespace std;
bool __hack = std::ios::sync_with_stdio(false);
auto __hack1 = cin.tie(nullptr);
namespace template_util {
constexpr int bytecount(uint64_t x) { return x ? 1 + bytecount(x >> 8) : 0; }
template <int N>
struct bytetype {};
template <uint64_t N>
struct minimal_uint : bytetype<bytecount(N)> {};
}  // namespace template_util
template <class T>
T next(istream& in) {
  T ret;
  in >> ret;
  return ret;
}
template <class T>
vector<T> next_vector(istream& in, size_t n) {
  vector<T> ret(n);
  for (size_t i = 0; i < n; ++i) {
    ret[i] = next<T>(in);
  }
  return ret;
}
int getSum(const vector<int>& sum, int from, int to) {
  return sum[to + 1] - sum[from];
}
void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  auto a = next_vector<int>(in, n);
  vector<int> sum1(n + 1), sum2(n + 1);
  for (int i = 0; i < (n); ++i) {
    sum1[i + 1] = sum1[i] + (a[i] == 1 ? 1 : 0);
    sum2[i + 1] = sum2[i] + (a[i] == 2 ? 1 : 0);
  }
  vector<pair<int, int>> result;
  for (int setOver = 0; setOver < n; ++setOver) {
    int s1 = getSum(sum1, 0, setOver);
    int s2 = getSum(sum2, 0, setOver);
    if (s1 == s2) {
      continue;
    }
    int setScore = max(s1, s2);
    if (s1 == setScore && a[setOver] != 1) {
      continue;
    }
    if (s2 == setScore && a[setOver] != 2) {
      continue;
    }
    bool canGoToEnd = true;
    int i = setOver + 1;
    int win1 = s1 > s2 ? 1 : 0;
    int win2 = s1 < s2 ? 1 : 0;
    int lastWin = win1 == 1 ? 1 : 2;
    while (i < n) {
      int le = i, ri = n - 1, res = -1;
      while (le <= ri) {
        int e = (le + ri) / 2;
        s1 = getSum(sum1, i, e);
        s2 = getSum(sum2, i, e);
        if (s1 < setScore && s2 < setScore) {
          le = e + 1;
        } else if (s1 > setScore || s2 > setScore) {
          ri = e - 1;
        } else if (s1 == setScore || s2 == setScore) {
          res = e;
          ri = e - 1;
        } else {
          throw 42;
        }
      }
      if (res == -1) {
        canGoToEnd = false;
        break;
      }
      s1 = getSum(sum1, i, res);
      s2 = getSum(sum2, i, res);
      if (s1 == setScore) {
        if (s2 == setScore) {
          throw 42;
        }
        ++win1;
        lastWin = 1;
      } else {
        ++win2;
        lastWin = 2;
      }
      i = res + 1;
    }
    if (canGoToEnd) {
      if (win1 != win2) {
        if (win1 > win2 && lastWin == 1) {
          result.push_back({max(win1, win2), setScore});
        } else if (win1 < win2 && lastWin == 2) {
          result.push_back({max(win1, win2), setScore});
        }
      }
    }
  }
  sort(result.begin(), result.end());
  out << result.size() << "\n";
  for (auto& p : result) {
    out << p.first << ' ' << p.second << "\n";
  }
}
int main() {
  solve(cin, cout);
  return 0;
}
