#include <bits/stdc++.h>
int main() {
  int x, i, a, b;
  scanf("%d", &x);
  int n[x];
  for (i = 0; i < x; i++) {
    scanf("%d", &n[i]);
    if (n[i] == 0)
      a = i;
    else
      b = i;
  }
  printf("%d\n", a < b ? a + 1 : b + 1);
}
