
#include <stdio.h>
#define Nmax 10000
#define Qmax 500

char BinarySearch(int );
int S[Nmax],n;

int main(){
  int q,i;
  int T[Qmax];
  int sum=0;
  char ans;

  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<q ; i++){
    ans = LinerSearch(T[i]);
    if(ans == 'T') sum++;
  }
  printf("%d\n",sum);

  return 0;
}

char BinarySearch(int key){
  int left=0;
  int right;
  int mid;

  right = n;
  
  while(left < right){
    mid = (left + right) / 2;
    if (S[mid] == key) return 'T';
    else if (key < S[mid]){
      right = mid;
    }
    else left = mid + 1;
    return NOT_FOUND;
  }
}