#include<stdio.h>
#define MAX 100000000
int linearSearch(int );
int n;
int main(){
  int i,q,s[MAX],t[MAX],res;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&t[i]);
  }
  
  for(i=0;i<q;i++){
    res += linearSearch(t[i]);
  }
  printf("%d",res);
  return 0;
}
int linearSearch(int a){
  int count =0,key;
  a = key;
  while(a!=key){
    count++;
    if(count==n)return 0;
  }
	      return count;
}