#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, a[200005], count1 = 0, count2 = 0;
  long long int i;
  cin >> n;
  long long int num1 = 0, num2 = 0;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == 0) {
      num1++;
    } else {
      num2++;
    }
  }
  for (i = 1; i <= n; i++) {
    if (a[i] == 0) {
      count1++;
      if (count1 == num1) {
        cout << i;
        return (0);
      }
    } else {
      count2++;
      if (count2 == num2) {
        cout << i;
        return (0);
      }
    }
  }
}
