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