// editor3
#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int data;
    struct node *next;
}node;
node *head=NULL,*tail;
void create(int num){
    node *newnode=(node*)malloc(sizeof(node));
    newnode->data=num;
    newnode->next=NULL;
    if(head==NULL){
        head=newnode;
        tail=newnode;
    }else{
        tail->next=newnode;
        tail=newnode;
    }
}
int findpos(int val){
    nd*temp=head;
    int pos=-1;
    while(temp!=NULL){
            if(temp->data==val){
                return pos;
                }
                temp=temp->next;
                pos++;
     }
     return -1;
}
int main(){
    int n,num;
    scanf("%d",&n);
    for(int i=0;i<=n;i++){
        scanf("%d",&num);
        create(num);
    }
    int val;
    scanf("%d",&val);
    int pos=findpos(val);
    if(pos==1){
        printf("-1");
    }
    else
    printf("%d",pos);
    return 0;
    
}