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