#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int S[100005];
int n;
int binarySearch(int key){
  int left = 0;
  int right = n - 1;
  int mid;
  while(left <= right){
    mid = (left + right) / 2;
    if(S[mid] == key){
      return 1;
    }
    else if(S[mid] < key)
      left = mid + 1;
    else
      right = mid - 1;

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

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

