#include<stdio.h>
#define N 100000

int main(){
  int S[N], T[N],  C[N], n1, n2, i, j, count=0;

  scanf("%d", &n1);
  for(i =0; i < n1; i++)
    scanf("%d", &S[i]);

  scanf("%d", &n2);
  for(i = 0; i < n2; i++)
    scanf("%d", &T[i]);

  for(i = 0; i < n1; i++){
    for(j = 0; j < n2; j++){
      if(S[i] == T[j])
	count++;
    }
  }

  printf("%d\n", count);

  return 0;
}