#include <stdio.h>
 
int main(){
  int S[1000], count = 0, s, t, x, i, j, left, right, mid;

  scanf("%d",&s);
  　for(i = 0; i < s; i++){
     scanf("%d",&S[i]);
    }
  scanf("%d",&t);
 
  for(i = 0; i < t; i++){
    left = 0;
    right = s;
     
    scanf("%d",&x);
    while(left < right){
      mid = (right + left)/2;
      if(S[mid] == x){
    count++;
    break;
      }
      else if(S[mid] > x){
    right = mid;
      }
      else if(S[mid] < x){
        left = mid + 1;
      }
    }
  }
  printf("%d\n",count);
  return 0;
}