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