#include <bits/stdc++.h>
int main() {
  unsigned int n;
  scanf("%u", &n);
  unsigned short a[n];
  unsigned register int c1 = 0, c2 = 0;
  for (unsigned register int i = 0; i < n; i++) {
    scanf("%hu", &a[i]);
    c1 += a[i] == 1;
    c2 += a[i] == 0;
  }
  for (unsigned register int i = 0; i < n; i++) {
    c1 -= a[i] == 1;
    c2 -= a[i] == 0;
    if (!c1 + !c2) {
      printf("%u\n", i + 1);
      break;
    }
  }
  return 0;
}
