#include<stdio.h>
#define N 100000
#define M 50000


int main(void){
  int i, j, n, q, S[N], T[M], count=0, t;
  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++){
    j=0;
    T[q] = a;

    while(T[j] != S[i]) j++;
    if(j < q){
      T[j] = -1;
      count++;
    }

  }
  printf("%d\n", count);
  return 0;
}