#include <stdio.h>

int n, m, data[10000];

char find(int x){
  int l = 0, r = n;
  while(r - l >= 1){
    int i = (l + r) / 2;
    if(data[i] == x) return 1;
    else if(data[i] < x) l = i + 1;
    else r = i;
  }
  return 0;
}

main(){
  int i, in, ans = 0;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d", &data[i]);
  }
  scanf("%d", &m);
  for(i=0;i<m;i++){
    scanf("%d", &in);
    if(find(in)) ans++;
  }
  printf("%d\n", ans);
  return 0;
}