#include <stdio.h>
#define N 10000

int main()
{
  int n, q, s[N], t[N], c=0, i, j;

  scanf("%d", &n);
  for(i=1; 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++){
    j=0;
    s[n+1] = t[i];
    while(s[j]!=t[i]){
      j++;
      if(j==n+1) break;
      if(s[j]==t[i])c++;
    }
  }
  printf("%d\n",c);

  return 0;
}