#include <bits/stdc++.h>
using namespace std;
const int Maxn = 3e5 + 10;
int t1, t0, n, a[Maxn];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    if (a[i] == 0)
      t0 = i + 1;
    else
      t1 = i + 1;
  }
  cout << min(t1, t0);
}
