#include <iostream>
using namespace std;
int n, a[1000000];
int main(){
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
cin >> n;
for (int i = 0; i < n; ++i)
{
cin >> a[i];
}
int ans = 0, mx = 0;
for (int i = 1; i < n; ++i)
{
if (a[0] == a[i])
{
ans = i + 1;
mx = max(mx, ans);
}
}
cout << mx;
return 0;
}