#include <stdio.h>
int main(){
  int i,j,n,key;
  int count=0;
  scanf("%d",&n);
  int S[n];
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&key);
  int T[key];
  for(i=0;i<key;i++){
    scanf("%d",&T[i]);
  }
  S[n]=key;
  while(S[i]!=key){
    i++;
    count++;
    if(i==n)
      break;
  }
  printf("%d\n",count);
  return 0;
}


  
