#include <bits/stdc++.h>
int main() {
  int n;
  int door[200005];
  scanf("%d", &n);
  int z = 0, y = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &door[i]);
    if (door[i] == 0)
      z++;
    else
      y++;
  }
  int zz = 0, yy = 0;
  int ans;
  for (int i = 0; i < n; i++) {
    if (door[i] == 0)
      zz++;
    else
      yy++;
    if (yy == y || zz == z) {
      ans = i;
      break;
    }
  }
  printf("%d\n", ans + 1);
  return 0;
}
