#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, mn = 7897897, i, j, a = 0, b = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> j;
    if (j == 0)
      a = i + 1;
    else
      b = i + 1;
  }
  cout << min(a, b);
  return 0;
}
