#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, lst0, lst1;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int c;
    scanf("%d", &c);
    if (c)
      lst1 = i;
    else
      lst0 = i;
  }
  cout << min(lst0, lst1) + 1;
}
