#include<stdio.h>

int main() {
  int n;
  int A[1000000],a,b;
  int s;
  int i,j,k=0;

  scanf("%d\n",&n);
  for (i=0; i<n; i++) {
    scanf("%d",&a);
    A[a]=1;
  }
  scanf("%d\n",&s);
  for (i=0; i<s; i++) {
    scanf("%d",&b);
    if (A[b]==1)
      k++;
  }
  printf("%d\n",k);
}