#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int arr[n];
  for (int x = 0; x < n; x++) {
    cin >> arr[x];
  }
  int f = 0;
  int g = 0;
  for (int x = 0; x < n; x++) {
    if (arr[x] == 0) {
      f = x;
    }
    if (arr[x] == 1) {
      g = x;
    }
  }
  cout << min(f, g) + 1;
}
