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

typedef struct _elem {
  struct _elem *next;
  int data;
} elem;

elem head = { &head, -1 };

void insert(int data) {
  elem *new;
  new = (elem *)malloc(sizeof(elem));

  new->data = data;
  new->next = head.next;
  head.next = new;
}

int search(int data) {
  elem *p;
  p = head.next;

  while(p != &head) {
    if(p->data == data)
      return 1;

    p = p->next;
  }

  return 0;
}

int main() {
  int n, q, i, tmp, cnt;

  scanf("%d", &n);
  for(i = 0;i < n;i++) {
    scanf("%d", &tmp);
    insert(tmp);
  }

  scanf("%d", &q);
  for(i = 0;i < q;i++) {
    scanf("%d", &tmp);
    if(search(tmp))
      cnt++;
  }

  printf("%d", cnt);

  return 0;
}

