#include <stdio.h>
#include <stdlib.h>
typedef struct node{
    int data;
    struct node *next;
}nd;
nd *head=NULL,*tail,*temp,*prev,*newnode;
int index=0;
void create(int val){
    newnode=(nd*)malloc(sizeof(nd));
    newnode->data=val;
    newnode->next=NULL;
    if(head==NULL){
        head=newnode;
        tail=newnode;
    }else{
        tail->next=newnode;
        tail=newnode;
    }
}
int delete(int val){
    temp=head;
    prev=NULL;
    while(temp!=NULL){
        if(temp->data==val){
            if(prev==NULL){
                head=temp->next;
            }else{
                prev->next=temp->next;
            }
            free(temp);
            return 1;
        }
        prev=temp;
        temp=temp->next;
    }
    return 0;
}
int search(int val){
    int count=0;
    temp=head;
    while(temp!=NULL){
        if(temp->data==val){
            count++;
            return 1;
            break;
        }
        temp=temp->next;
    }
    index=count;
    return 0;
}
void display(){
    temp=head;
    while(temp!=NULL){
        printf("%d ",temp->data);
        temp=temp->next;
    }
}
int main(){
    int n;
    scanf("%d",&n);
    if(n<0){
        printf("Invalid Input");
        return 0;
    }
    int x;
    for(int i=0;i<n;i++){
        if(scanf("%d",&x)!=1){
            printf("Invalid Input");
            return 0;
        }
        create(x);
    }
    int x;
    scanf("%d",&x);
    if(search(x)!=1){
        printf("-1");
        return 0;
    }
    else{
        printf("%d",index);
    }
    return 0;
}