#include<stdio.h>
#define N 100000
#define Q 50000
int main()
{
  int i, j, n, q, s[N], t[Q], c=0, mid;
  
  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++){
    mid = n / 2 + 1;
    if(0 <= t[i] && t[i] < s[mid]){
      for(j = 0; j < mid; j++){
	if(t[i] == s[j]){
	  c++;
	  break;
	}
      }
    }
    else if(s[mid] < t[i] && t[i] <= s[n-1]){
      for(j = mid + 1; j < n; j++){
	if(t[i] == s[j]){
	  c++;
	  break;
	}
      }
    }
    else{
      if(t[i] == s[mid]){
	c++;
	break;
      }
    }
  }

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

  return 0;
}