#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MAX_N = 100005;
vector<int> g[MAX_N];
int don[MAX_N], vis[MAX_N];
int bfs(int r) {
queue<pair<int, int>> q;
q.push({r, 0});
vis[r] = r;
while(!q.empty()) {
int u, d;
tie(u, d) = q.front();
if(u!=r && don[u])
break;
q.pop();
for(int v : g[u])
if(vis[v]!=r)
q.push({v, d+1}), vis[v] = r;
}
return q.front().second;
}
int bfs1(int r, int mxd) {
queue<pair<int, int>> q;
q.push({r, 0});
vis[r] = r;
int c = 0;
while(!q.empty()) {
int u, d;
tie(u, d) = q.front();
if(d>mxd)
break;
q.pop();
c++;
for(int v : g[u])
if(vis[v]!=r)
q.push({v, d+1}), vis[v] = r;
}
return c;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N, M, K;
cin >> N >> M >> K;
for(int i=0; i<M; i++) {
int u, v;
cin >> u >> v;
g[u].push_back(v);
g[v].push_back(u);
}
memset(don, 0, sizeof don);
for(int i=0; i<K; i++) {
int u;
cin >> u;
don[u] = 1;
}
if(K==1) {
cout << N << "\n";
return 0;
}
int dd = INF;
memset(vis, 0, sizeof vis);
for(int u=1; u<=N; u++)
if(don[u])
dd = min(dd, bfs(u));
dd = (dd-1)/2;
int ans = 0;
memset(vis, 0, sizeof vis);
for(int u=1; u<=N; u++)
if(don[u])
ans += bfs1(u, dd);
cout << ans << "\n";
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpjb25zdCBpbnQgSU5GID0gMWU5Owpjb25zdCBpbnQgTUFYX04gPSAxMDAwMDU7Cgp2ZWN0b3I8aW50PiBnW01BWF9OXTsKaW50IGRvbltNQVhfTl0sIHZpc1tNQVhfTl07CgppbnQgYmZzKGludCByKSB7CglxdWV1ZTxwYWlyPGludCwgaW50Pj4gcTsKCXEucHVzaCh7ciwgMH0pOwoJdmlzW3JdID0gcjsKCXdoaWxlKCFxLmVtcH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