#include <bits/stdc++.h>

//#define fin cin
//#define fout cout

#define F first
#define S second

using namespace std;

typedef long long ll;

const int inf = 0x3f3f3f3f;

int d , n , m , i , j , k;
int a[1010] , bst[1010];
bool ok[1010][1010];
bool ap[1010];

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    #endif // ONLINE_JUDGE

    /*
    #ifndef ONLINE_JUDGE
    ifstream fin("input.in");
    ofstream fout("output.out");
    #endif // ONLINE_JUDGE
    */

    scanf("%d %d %d", &d, &n, &m);
    for (i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        ap[a[i]] = 1;
    }

    for (i = 1; i <= m; ++i)
    {
        int x , y;
        scanf("%d %d", &x, &y);
        ok[x][y] = 1;
    }

    for (int l = d; l ; --l)
        for (i = 1; i <= d - l + 1; ++i)
        {
            j = i + l - 1;

            if (!ok[i][j]) continue;
            if (!ap[i]) ok[i+1][j] = 1;
            if (!ap[j]) ok[i][j-1] = 1;
        }


    memset(bst , inf , sizeof(bst));

    bst[0] = 0;
    for (i = 1; i <= n; ++i)
    {
        for (j = i; j ; --j)
            if (ok[a[j]][a[i]]) bst[i] = bst[j-1] + 1;

    }

    printf("%d\n", bst[n]);

    return 0;
}