#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "; ";
  err(++it, args...);
}
int main() {
  ios::sync_with_stdio(false);
  int n, tmp;
  cin >> n;
  int zero = 0, one = 0;
  for (int i = 0; i < int(n); i++) {
    cin >> tmp;
    if (tmp == 0)
      zero = i;
    else
      one = i;
  }
  cout << min(zero, one) + 1 << endl;
  return 0;
}
