#include<stdio.h>
#define MAX 100000

int main(){
  int i, j, n, q, l,m,r, count=0, S[MAX],T[MAX];

  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++){
    l=0;
    r=n;
    m=(l+r)/2;
    while(l <+ r){
      m=(l+r)/2;
      if(T[i] == S[m]){
        count++;
        break;
      }else if(T[i] > S[m]){
        l = m+1;
      }else if(T[i] < S[m]){
        r = m;
      }
    }

  }


  printf("%d\n",count);

  return 0;
}

