#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int test = 1;
  for (int loop = 0; loop < test; loop++) {
    long long int n;
    cin >> n;
    long long int last_0 = 0;
    long long int last_1 = 0;
    long long int i = 0;
    while (i < n) {
      int x;
      cin >> x;
      if (x == 0) {
        last_0 = i;
      } else {
        last_1 = i;
      }
      ++i;
    }
    cout << min(last_0, last_1) + 1;
    return 0;
  }
}
