#include<stdio.h>
int main()
{
    int vruh=0;
    int N,U,V,i;
    scanf("%d", &N);
    int more_important[N+1][N+1];
    //more_important[X][Y] X po-vajen ot Y
    int num_more_imp[N+1];
    int less_important[N+1][N+1];
    //less_important[X][Y] X po-nevajen ot Y
    int num_less_imp[N+1];
    //[worker][more_important][less_important]
    for(i = 0;i <= N;i++)
    {
        num_more_imp[i] = 0;
        num_less_imp[i] = 0;
    }
    for(i = 0;i < N-1;i++)
    {
        scanf("%d %d", &U,&V);

        more_important[U][num_more_imp[U]] = V;
        num_more_imp[V]++;
        less_important[V][num_less_imp[V]] = U;
        num_less_imp[U]++;
    }
    int Q,M,X,res,q;
    scanf("%d", &Q);

    int answers[Q];
    for(i = 0;i < Q;i++)
    {
        scanf("%d", &M);
        answers[i] = M;
    }
    for(i = 0;i < Q;i++)
    {
        X = answers[i];

        res=res + num_less_imp[X];
        for(q=0;q<num_less_imp[X];q++)
        {
            //
        }
    }
    printf("%d",res);
    return 0;
}
