#include<stdio.h>
#define N 100000

int linerSearch(int,int,int *);

int main(){

  int n,m,j,key,count=0,A[N];

  scanf("%d",&n);
  for(j = 0 ; j < n ; j++){
    scanf("%d",&A[j]);
  }

  scanf("%d",&m);
  for(j = 0 ; j < m ; j++){
    scanf("%d",&key);
    
    if(linerSearch(n,key,A) == 1) count++;
  }

  printf("%d\n",count);
  return 0;
}


int linerSearch(int n,int key,int A[])
{
  int i = 0;
  A[n] = key;
  while(A[i] != key){
    i++;
    if(i = n) return -1;
  } 
  return 1;
}