#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a0 = 0, a1 = 0;
  for (int i = 1; i <= n; i++) {
    int temp;
    cin >> temp;
    if (temp == 0) {
      a0 = i;
    } else if (temp == 1) {
      a1 = i;
    }
  }
  cout << min(a0, a1) << endl;
  return 0;
}
