#include<stdio.h>

int main()
{
  int n, m, S[1000000000], T[1000000000], i, j, count;
  count = 0;
  
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &S[i]);
  }
  
  scanf("%d", &m);
  for(i = 0; i < m; i++){
    scanf("%d", &T[i]);
  }
  
  for(i = 0; i < m; i++){
    for(j = 0; j < n; j++){
      if(T[i] == S[j]){
        count++;
      }
    }
  }
  
  printf("%d\n", count);
}