#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  long long res = 1;
  a = a % 1000000007;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % 1000000007;
      b--;
    }
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return res;
}
long long fermat_inv(long long y) { return power(y, 1000000007 - 2); }
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    int n;
    cin >> n;
    int a, b;
    a = b = 0;
    for (int i = 0; i < n; i++) {
      int c;
      cin >> c;
      if (c == 0)
        a = i + 1;
      else
        b = i + 1;
    }
    cout << (min(a, b)) << "\n";
  }
  return 0;
}
