#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  int n;
  int l = 0, r = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == 1) {
      l++;
    } else {
      r++;
    }
  }
  int ll = 0, rr = 0;
  for (int i = 1; i < +n; i++) {
    if (a[i] == 1) {
      ll++;
    } else {
      rr++;
    }
    if (ll == l || rr == r) {
      cout << i << endl;
      break;
    }
  }
}
