#include<stdio.h>

int search(int S[], int n, int T[], j){
  int i = 0;
  int j;
  S[n] = T[j];
  while ( S[i] != T[j]) i++;
  return i != n;
}

int main(){

  int n, q, C, i;
  int S[10000], T[500];
  C = 0;

  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]);
    if ( search(S, n, T, i) ) C++;
  }

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

  return 0;
}

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

  return 0;
}
  