#include<stdio.h>
main(){
  int n, q, S[10000], T[500], i, j, key, c=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++){
    key = S[i];
   T[q] = key;
   j = 0;
    while(T[j] != key){
      j++;
    }
    if(j != q){
      c++;
    }
  }
  printf("%d\n", c);
}