#include <stdio.h>
int main()
{
  int n, q, i, j, check = 1, count = 0;
  int s[10000], t[500];

  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<n; i++) {
    j = 0;
    s[n] = t[i];
    while(s[j] != t[i]) {
      j++;
      if(j == n) {
        check = 0;
      }
    }
    if(check == 1)
      count++;
    else
      check = 1;
  }
  printf("%d\n", count);
  return 0;
}