#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool fs(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c < '0' || c > '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
int main() {
  int n;
  fs(n);
  vector<int> vv(n);
  for (int i = 0; i < n; i++) {
    fs(vv[i]);
  }
  for (int i = n - 1; i >= 0; i--) {
    if (vv[i] != vv[n - 1]) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  return 0;
}
