#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
class InParser {
private:
FILE *fin;
char *buff;
int sp;
char read_ch() {
++sp;
if (sp == 4096) {
sp = 0;
fread(buff, 1, 4096, fin);
}
return buff[sp];
}
public:
InParser(const char* nume) {
fin = fopen(nume, "r");
buff = new char[4096]();
sp = 4095;
}
InParser& operator >> (int &n) {
char c;
while (!isdigit(c = read_ch()) && c != '-');
int sgn = 1;
if (c == '-') {
n = 0;
sgn = -1;
} else {
n = c - '0';
}
while (isdigit(c = read_ch())) {
n = 10 * n + c - '0';
}
n *= sgn;
return *this;
}
InParser& operator >> (long long &n) {
char c;
n = 0;
while (!isdigit(c = read_ch()) && c != '-');
long long sgn = 1;
if (c == '-') {
n = 0;
sgn = -1;
} else {
n = c - '0';
}
while (isdigit(c = read_ch())) {
n = 10 * n + c - '0';
}
n *= sgn;
return *this;
}
};
InParser fin("dtcsu.in");
ofstream fout("dtcsu.out");
const int LINII = 276'997;
const int MOD = 10'007;
vector <long long> rest[MOD + 1];
void addHash(long long nr){
int r = nr % MOD;
//nu se repeta numerele
//asa ca nu mai trebuie sa verificam
rest[r].push_back(nr);
}
void read_all_Lines(){
for (int i = 1; i <= LINII; i++){
long long x;
fin >> x;
addHash(x);
}
}
bool inHash(long long nr){
int r = nr % MOD;
for (long long x : rest[r]){
if (x == nr){
return 1;
}
}
return 0;
}
int main(){
read_all_Lines();
int Q;
fin >> Q;
int rez = 0;
for (int i = 1; i <= Q; i++){
long long nr;
fin >> nr;
rez += inHash(nr);
}
fout << rez;
return 0;
}