#include<stdio.h>

int main(void){
  int n, i, q, a, count = 0;
  scanf("%d\n", &n);
  int S[n];
  for(i=0;i<n;i++) scanf("%d",S[i]);
  scanf("%d\n", &q);
  for(i=0;i<q;i++){
    scanf("%d",&a);
      if(S[i] == a){
        count++;
        break;
      }
  }
  printf("%d\n", count);
  return 0;
}