#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int count1 = 0, count2 = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 0) {
      count1++;
    } else {
      count2++;
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      count1 = count1 - 1;
    } else {
      count2 = count2 - 1;
    }
    sum++;
    if (count1 == 0) {
      cout << sum << endl;
      break;
    } else if (count2 == 0) {
      cout << sum << endl;
      break;
    }
  }
  return 0;
}
