#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, inp, last0, last1, i = 1;
  cin >> n;
  while (n--) {
    cin >> inp;
    if (inp == 0)
      last0 = i;
    else
      last1 = i;
    i++;
  }
  cout << min(last0, last1) << endl;
}
