#include<bits/stdc++.h>
using namespace std;
#define ll long long
int last_index(ll a[],ll n,ll key)
{
if(n==0)
{
return -1;
}
if(a[n-1]==key)
{
return 0;
}
ll i=last_index(a,n-1,key);
return i+1;
}
int main()
{
// let’s play
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin>>n;
ll a[n];
for(ll i=0;i<n;i++)
cin>> a[i];
ll key;
cin>>key;
int last=last_index(a,n,key);
cout<<n-1-last<<endl;
return 0;
}