#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  int o = 0, c = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i])
      o = i;
    else
      c = i;
  }
  cout << min(o, c) + 1;
  return 0;
}
