#include <bits/stdc++.h>

template <class Key, class Tp>
class rbtree{
    struct node{
        bool is_black;
        node* parent;
        node* children[2];
        Key key;
        Tp value;
        size_t count;

        node(bool color_=RED, node* parent_=nullptr)
            : is_black(color_), parent(parent_), children{nullptr, nullptr}, count(0) {}
    };

    node *root;
    void rotate_l(node *pos){
        node *par = pos->parent, *ch = pos->children[1], *gc = ch->children[0];
        pos->count -= 1 + ch->children[1]->count;
        ch->count += 1 + pos->children[0]->count;
        if(par != nullptr) par->children[par->children[1] == pos] = ch;
        else root = ch;
        ch->parent = par;
        ch->children[0] = pos;
        pos->parent = ch;
        pos->children[1] = gc;
        gc->parent = pos;
    }
    void rotate_r(node *pos){
        node *par = pos->parent, *ch = pos->children[0], *gc = ch->children[1];
        pos->count -= 1 + ch->children[0]->count;
        ch->count += 1 + pos->children[1]->count;
        if(par != nullptr) par->children[par->children[1] == pos] = ch;
        else root = ch;
        ch->parent = par;
        ch->children[1] = pos;
        pos->parent = ch;
        pos->children[0] = gc;
        gc->parent = pos;
    }
    void adjust_ins(node *n){
        if(n->parent == nullptr){
            n->is_black = true;
            return;
        }
        if(n->parent->is_black) return;

        node *p = n->parent, *g = p->parent;
        node *u = g->children[g->children[0] == p];
        if(!u->is_black){
            p->is_black = u->is_black = true;
            g->is_black = false;
            adjust_ins(g);
            return;
        }
        if(p == g->children[0] && n == p->children[1]){
            rotate_l(p);
            rotate_r(g);
            n->is_black = true;
            g->is_black = false;
            return;
        }
        if(p == g->children[1] && n == p->children[0]){
            rotate_r(p);
            rotate_l(g);
            n->is_black = true;
            g->is_black = false;
            return;
        }
        if(p == g->children[0]) rotate_r(g);
        else rotate_l(g);
        p->is_black = true;
        g->is_black = false;
    }
    void adjust_ers(node *n){
        if(n->parent == nullptr) return;
        node *p = n->parent, *s = p->children[n == p->children[0]];
        if(!s->is_black){
            p->is_black = false;
            s->is_black = true;
            if(s == p->children[0]){
                s = s->children[1];
                rotate_r(p);
            }else{
                s = s->children[0];
                rotate_l(p);
            }
        }
        if(s->children[0]->is_black && s->children[1]->is_black){
            if(p->is_black){
                s->is_black = false;
                adjust_ers(p);
            }else{
                p->is_black = true;
                s->is_black = false;
            }
        }else{
            if(!s->children[0]->is_black && n == p->children[0]){
                s->children[0]->is_black = true;
                s->is_black = false;
                rotate_r(s);
                s = s->parent;
            }else if(!s->children[1]->is_black && n == p->children[1]){
                s->children[1]->is_black = true;
                s->is_black = false;
                rotate_l(s);
                s = s->parent;
            }
            if(n == p->children[0]){
                rotate_l(p);
                std::swap(p->is_black, s->is_black);
                s->children[1]->is_black = true;
            }else{
                rotate_r(p);
                std::swap(p->is_black, s->is_black);
                s->children[0]->is_black = true;
            }
        }
    }
    bool is_nil(node *pos){
        return pos->children[0] == nullptr && pos->children[1] == nullptr;
    }
    node *subtree_max(node *r){
        while(!is_nil(r->children[1])) r = r->children[1];
        return r;
    }
public:
    static constexpr bool RED = false, BLACK = true;
    using node_ptr = node*;

    rbtree(){
        root = new node(BLACK);
    }
    Tp get(Key key){
        node *n = root;
        while(!is_nil(n)){
            if(n->key < key) n = n->children[1];
            else if(n->key > key) n = n->children[0];
            else return n->value;
        }
        return Tp{};
    }
    node_ptr get_by_order(size_t ord){
        node *n = root;
        while(n){
            if(ord == n->children[0]->count) return n;
            else if(ord < n->children[0]->count) n = n->children[0];
            else{
                ord -= (n->children[0]->count) + 1;
                n = n->children[1];
            }
        }
        return nullptr;
    }
    bool exist(Key key){
        node *n = root;
        while(!is_nil(n)){
            if(n->key < key) n = n->children[1];
            else if(n->key > key) n = n->children[0];
            else return true;
        }
        return false;
    }
    bool insert(Key key, Tp val=Tp{}){
        node *pos = root;
        while(!is_nil(pos)){
            if(key < pos->key)  pos = pos->children[0];
            else if(key > pos->key) pos = pos->children[1];
            else{
                pos->value = val;
                return false;
            }
        }
        pos->children[0] = new node(BLACK, pos);
        pos->children[1] = new node(BLACK, pos);
        pos->key = key;
        pos->value = val;
        for(auto p=pos;p!=nullptr;p=p->parent) ++(p->count);
        if(pos->parent == nullptr) return true;
        pos->is_black = false;
        adjust_ins(pos);

        return true;
    }
    bool erase(node_ptr ptr){
        if(is_nil(ptr->children[0]) && is_nil(ptr->children[1])){
            delete ptr->children[0];
            delete ptr->children[1];
            ptr->children[0] = nullptr;
            ptr->children[1] = nullptr;
            for(auto p=ptr;p!=nullptr;p=p->parent) --(p->count);
            if(!ptr->is_black){
                ptr->is_black = true;
                return true;
            }
            adjust_ers(ptr);
        }else if(is_nil(ptr->children[0])){
            if(ptr->parent != nullptr) ptr->parent->children[ptr->parent->children[1] == ptr] = ptr->children[1];
            else root = ptr->children[1];
            ptr->children[1]->parent = ptr->parent;
            for(auto p=ptr->parent;p!=nullptr;p=p->parent) --(p->count);
            if(!ptr->is_black || !ptr->children[1]->is_black){
                ptr->children[1]->is_black = true;
                delete ptr->children[0];
                delete ptr;
                return true;
            }
            adjust_ers(ptr->children[1]);
            delete ptr->children[0];
            delete ptr;
        }else if(is_nil(ptr->children[1])){
            if(ptr->parent != nullptr) ptr->parent->children[ptr->parent->children[1] == ptr] = ptr->children[0];
            else root = ptr->children[0];
            ptr->children[0]->parent = ptr->parent;
            for(auto p=ptr->parent;p!=nullptr;p=p->parent) --(p->count);
            if(!ptr->is_black || !ptr->children[0]->is_black){
                ptr->children[0]->is_black = true;
                delete ptr->children[1];
                delete ptr;
                return true;
            }
            adjust_ers(ptr->children[0]);
            delete ptr->children[1];
            delete ptr;
        }else{
            node *c = subtree_max(ptr->children[0]);
            ptr->key = c->key;
            ptr->value = c->value;
            erase(c);
        }
        return true;
    }
    bool erase(Key key){
        node *pos = root;
        while(!is_nil(pos)){
            if(key < pos->key)  pos = pos->children[0];
            else if(key > pos->key) pos = pos->children[1];
            else return erase(pos);
        }
        return false;
    }
};

int main(){
    rbtree<int, int> r;
    int n, q, s, t, ans = 0;
    std::cin >> n;
    for(int i=0;i<n;++i){
        std::cin >> s;
        r.insert(s);
    }
    std::cin >> q;
    for(int i=0;i<q;++i){
        std::cin >> t;
        if(r.exist(t)) ++ans;
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 15568