#include <bits/stdc++.h>
using namespace std;
int n, k;
bool a[201000];
int r = 0;
int l = 0;
int sumr = 0;
int suml = 0;
int i, z;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == true) {
      r++;
    } else {
      l++;
    }
  }
  for (z = 0; z <= n; z++) {
    if (a[z] == true) {
      sumr++;
      if (sumr == r) {
        cout << z + 1;
        break;
      } else {
        continue;
      }
    } else {
      suml++;
      if (suml == l) {
        cout << z + 1;
        break;
      } else {
        continue;
      }
    }
  }
}
