#include<stdio.h>
#define N 10000

int main(){
  int n, q;
  int i, j, num=0;
  int s[N], t[N];

  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 < n ; i++){
    for( j = 0; j < q ; j++){
      if( s[i] == t[j] ){
	num++;
      }
    }
  }

  printf("%d\n" ,num);
  return 0; // Don't forget return 0
}