Code
N,M,K = map(int, input().split())
# 连通子图数量
mapper = [[] for i in range(N+1)]
for m in range(M):
a,b = map(int,input().split())
mapper[a].append(b)
mapper[b].append(a)
query = list(map(int,input().split()))
# print(query)
def dfs(cur):
global q
vis[cur]=1
for i in mapper[cur]:
if vis[i]==0 and i!=q:
dfs(i)
for qq in query:
res = 0
q = qq
vis = [0 for i in range(N+1)]
for i in range(1,N+1):
if vis[i]==0 and i!=q:
res+=1
dfs(i)
print(res-1)