#include<stdio.h>

int search(int);
int a[10000], p = 1, r = 1;

main(){
  int i, j, n, q, count = 0, S[10000], T[500];
  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++){
    if(search(T[i]) == 1){
      for(j = 0;j < n;j++){
        if(S[j] == T[i]){
          count++;
        }
      }
    }
  }
  printf("%d\n", count);
  return 0;
}

int search(int num){
  int i;
  for(i = 0;i < p;i++){
    if(num == a[i]){
      return 0;
    }
  }
  a[p++] = num;
  return 1;
}