#include<stdio.h>
#define N 100000
#define M 50000


int main(void){
  int i, j, n, q, S[N], T[M], key, b, count=0, co;
  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++){
    for(j=0; j<q ;j++){
      
      key = S[i];
      T[q] = key;
      b = T[j];
      if(key == b) { 
	count++;
	T[j] = -1; 
      }
      co++;
      if(co==q)break;
    }
  }
  printf("%d\n", count);
  return 0;
}