#include <stdio.h>

int main()
{

int a, b, i, j, suretsus[10000], suretsut[500], c = 0;

scanf ("%d\n", "%d\n", "%d\n", "%d",&i, &suretsus[10000], &j, &suretsut[500]);

for (a = 0; a < i; a++) {

for (b = 0; b < j; b++) {

if (suretsus[a] == suretsut[b])
c++;
}
}

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

return 0;
}