#include <bits/stdc++.h>
using namespace std;
int n, ar[2], indx, a[200010];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ar[a[i]]++;
  }
  for (int i = 0; i < n; i++) {
    ar[a[i]]--;
    indx++;
    if (ar[a[i]] == 0) break;
  }
  cout << indx << endl;
  return 0;
}
