#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long int INFL = 1e18;
int main(void) {
  cin.sync_with_stdio(false), cin.tie(NULL);
  int N;
  cin >> N;
  int last[2];
  for (int i = 0; i < N; i++) {
    int val;
    cin >> val;
    last[val] = i;
  }
  cout << min(last[0], last[1]) + 1 << '\n';
  return 0;
}
