#include <bits/stdc++.h>
using namespace std;
long long n, dilraba;
int d[200005];
int temp;
void nhap() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> d[i];
  }
}
void xuat() { cout << dilraba; }
void xuli() {
  dilraba = 0;
  for (long long i = 1; i <= n; i++) {
    if (d[i] != d[i - 1]) {
      dilraba = i - 1;
      temp = d[i - 1];
    }
    if (d[i] == temp) dilraba = i;
  }
}
int main() {
  nhap();
  xuli();
  xuat();
}
