#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
using namespace std;
const int N = 1e3 + 10;
int k, n, m;
bool g[N][N];
int cnt[N];
int cows[N];
bool st[N];
bool bfs(int u)
{
queue<int> q;
q.push(u);
st[u] = true;
cnt[u]++;
while(q.size())
{
int t = q.front();
q.pop();
st[t] = true;
for(int i = 1; i <= n; i++)
if(!st[i] && i != t && g[t][i])
{
q.push(i);
cnt[i]++;
}
}
}
int main()
{
scanf("%d%d%d", &k, &n, &m);
for(int i = 1; i <= k; i++) scanf("%d", &cows[i]);
for(int i = 1; i <= n; i++) g[i][i] = true;
int a, b;
while(m--)
{
scanf("%d%d", &a, &b);
g[a][b] = true;
}
for(int i = 1; i <= k; i++)
{
bfs(cows[i]);
memset(st, 0, sizeof st);
}
int res = 0;
for(int i = 1; i <= n; i++)
if(cnt[i] == k)
res++;
printf("%d\n", res);
return 0;
}