#include <bits/stdc++.h>
using namespace std;
int reader_pt = 1048576, reader_last;
char reader_buf[1048576];
int writer_pt = 0;
char writer_buf[1048576];
void reader(int *x) {
  int k, m = 0;
  *x = 0;
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (k) = reader_buf[reader_pt++];
    };
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      *x = k - '0';
      break;
    }
  }
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (k) = reader_buf[reader_pt++];
    };
    if (k < '0' || k > '9') break;
    *x = (*x) * 10 + k - '0';
  }
  if (m) (*x) = -(*x);
}
void reader(long long *x) {
  int k, m = 0;
  *x = 0;
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (k) = reader_buf[reader_pt++];
    };
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      *x = k - '0';
      break;
    }
  }
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (k) = reader_buf[reader_pt++];
    };
    if (k < '0' || k > '9') break;
    *x = (*x) * 10 + k - '0';
  }
  if (m) (*x) = -(*x);
}
int reader(char c[]) {
  int i, s = 0;
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (i) = reader_buf[reader_pt++];
    };
    if (i != ' ' && i != '\n' && i != '\r' && i != '\t' && i != EOF) break;
  }
  c[s++] = i;
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (i) = reader_buf[reader_pt++];
    };
    if (i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF) break;
    c[s++] = i;
  }
  c[s] = '\0';
  return s;
}
template <class T, class S>
void reader(T *x, S *y) {
  reader(x);
  reader(y);
}
template <class T, class S, class U>
void reader(T *x, S *y, U *z) {
  reader(x);
  reader(y);
  reader(z);
}
template <class T, class S, class U, class V>
void reader(T *x, S *y, U *z, V *w) {
  reader(x);
  reader(y);
  reader(z);
  reader(w);
}
void writer(int x, char c) {
  int s = 0, m = 0;
  char f[10];
  if (x < 0) m = 1, x = -x;
  while (x) f[s++] = x % 10, x /= 10;
  if (!s) f[s++] = 0;
  if (m) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = ('-');
  };
  while (s--) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (f[s] + '0');
  };
  {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (c);
  };
}
void writer(long long x, char c) {
  int s = 0, m = 0;
  char f[20];
  if (x < 0) m = 1, x = -x;
  while (x) f[s++] = x % 10, x /= 10;
  if (!s) f[s++] = 0;
  if (m) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = ('-');
  };
  while (s--) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (f[s] + '0');
  };
  {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (c);
  };
}
void writer(const char c[]) {
  int i;
  for (i = 0; c[i] != '\0'; i++) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (c[i]);
  };
}
void writer(const char x[], char c) {
  int i;
  for (i = 0; x[i] != '\0'; i++) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (x[i]);
  };
  {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (c);
  };
}
template <class T>
void writerLn(T x) {
  writer(x, '\n');
}
template <class T, class S>
void writerLn(T x, S y) {
  writer(x, ' ');
  writer(y, '\n');
}
template <class T, class S, class U>
void writerLn(T x, S y, U z) {
  writer(x, ' ');
  writer(y, ' ');
  writer(z, '\n');
}
template <class T>
void writerArr(T x[], int n) {
  int i;
  if (!n) {
    {
      if (writer_pt == 1048576)
        writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
      writer_buf[writer_pt++] = ('\n');
    };
    return;
  }
  for (i = 0; i < n - 1; i++) writer(x[i], ' ');
  writer(x[n - 1], '\n');
}
template <class T>
void sort(int N, T a[], void *mem = NULL) {
  sort(a, a + N);
}
template <class T1, class T2>
void sort(int N, T1 a[], T2 b[], void *mem) {
  int i;
  pair<T1, T2> *r = (pair<T1, T2> *)mem;
  for (i = 0; i < N; i++) r[i].first = a[i], r[i].second = b[i];
  sort(r, r + N);
  for (i = 0; i < N; i++) a[i] = r[i].first, b[i] = r[i].second;
}
template <class T1, class T2, class T3>
void sort(int N, T1 a[], T2 b[], T3 c[], void *mem) {
  int i;
  pair<T1, pair<T2, T3> > *r = (pair<T1, pair<T2, T3> > *)mem;
  for (i = 0; i < N; i++)
    r[i].first = a[i], r[i].second.first = b[i], r[i].second.second = c[i];
  sort(r, r + N);
  for (i = 0; i < N; i++)
    a[i] = r[i].first, b[i] = r[i].second.first, c[i] = r[i].second.second;
}
template <class T1, class T2, class T3, class T4>
void sort(int N, T1 a[], T2 b[], T3 c[], T4 d[], void *mem) {
  int i;
  pair<pair<T1, T2>, pair<T3, T4> > *r =
      (pair<pair<T1, T2>, pair<T3, T4> > *)mem;
  for (i = 0; i < N; i++)
    r[i].first.first = a[i], r[i].first.second = b[i], r[i].second.first = c[i],
    r[i].second.second = d[i];
  sort(r, r + N);
  for (i = 0; i < N; i++)
    a[i] = r[i].first.first, b[i] = r[i].first.second, c[i] = r[i].second.first,
    d[i] = r[i].second.second;
}
int N;
int in[110000];
int Aind[110000], Arev[110000], As;
int Bind[110000], Brev[110000], Bs;
int nxA[110000], nxB[110000];
int res1[110000], res2[110000], ress;
int main() {
  int i, j, k;
  int p, n1, n2;
  int win1, win2;
  void *mem = malloc(10000000);
  reader(&N);
  for (i = 0; i < N; i++) reader(in + i);
  for (i = 0; i < N; i++) {
    if (in[i] == 1) Aind[As++] = i;
    if (in[i] == 2) Bind[Bs++] = i;
  }
  for (i = 0; i < As; i++) Arev[Aind[i]] = i;
  for (i = 0; i < Bs; i++) Brev[Bind[i]] = i;
  nxA[N] = nxB[N] = N;
  for (i = N - 1; i >= 0; i--) {
    nxA[i] = nxA[i + 1];
    nxB[i] = nxB[i + 1];
    if (in[i] == 1) nxA[i] = i;
    if (in[i] == 2) nxB[i] = i;
  }
  for (k = 1; k < N + 1; k++) {
    p = 0;
    win1 = win2 = 0;
    for (;;) {
      n1 = nxA[p];
      n2 = nxB[p];
      if (n1 < N) {
        n1 = Arev[n1] + k - 1;
        if (n1 >= As)
          n1 = N;
        else
          n1 = Aind[n1];
      }
      if (n2 < N) {
        n2 = Brev[n2] + k - 1;
        if (n2 >= Bs)
          n2 = N;
        else
          n2 = Bind[n2];
      }
      if (min(n1, n2) == N) break;
      if (n1 < n2)
        win1++;
      else
        win2++;
      if (min(n1, n2) == N - 1) {
        if ((n1 == N - 1 && win1 > win2) || (n2 == N - 1 && win1 < win2)) {
          res2[ress] = k;
          res1[ress++] = max(win1, win2);
        }
        break;
      }
      p = min(n1, n2) + 1;
    }
  }
  sort(ress, res1, res2, mem);
  writerLn(ress);
  for (i = 0; i < ress; i++) writerLn(res1[i], res2[i]);
  {
    fwrite(writer_buf, sizeof(char), writer_pt, stdout);
    writer_pt = 0;
  };
  return 0;
}
