#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int linearsearch(int *S, int n, int *T, int q){
  int count = 0;
  for(int j = 0; j < q; ++j){
    for(int i = 0; i < n; ++i){
      if(T[j] == S[i]){
        ++count;
        break;
      }
    }
  }
  return count;
}

int main(){
  int n, q;
  scanf("%d", &n);
  int S[n];
  for(int i = 0; i < n; ++i){
    scanf("%d", &S[i]);

  }
  scanf("%d", &q);
  int T[q];
  for(int i = 0; i < q; ++i){
    scanf("%d", &T[i]);
  }
  printf("%d\n", linearsearch(S, n, T, q));
  return 0;
}

