#include<stdio.h>

#define N 10001
#define Q 501

int n,q;
int S[N],T[Q];

int linearSearch(int x){
  int i = 0;
  int key;
  key=S[x];
  while(T[i]!=key){
    i++;
    if(i==q)
      return -1;
  }
    return i;
}

int main(){

  int i,jude;
  int cnt=0;
  
  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<n;i++){
    jude = linearSearch(i);
  if(jude!=-1)
    cnt++;
  }
  printf("%d\n",cnt);
  return 0;
}