#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long l0 = -1, l1 = -1;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    if (x == 1) {
      l1 = i;
    } else {
      l0 = i;
    }
  }
  cout << min(l1, l0) + 1;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
