@staticmethod
def d():
    (n, g, e) = map(int, sys.stdin.readline().split())
    p = [int(x) for x in sys.stdin.readline().split()]
    (x, y) = ([], [])
    for _ in range(e):
        (a, b) = map(int, sys.stdin.readline().split())
        x.append(a)
        y.append(b)
        x.append(b)
        y.append(a)
    for a in p:
        x.append(a)
        y.append(n)
    if (not x):
        print(0)
        return
    c = ([1] * len(x))
    min_cut = maximum_flow(csr_matrix((c, (x, y)), ((n + 1), (n + 1))), source=0, sink=n).flow_value
    print(min_cut)
@staticmethod
def d():
    (n, g, e) = map(int, sys.stdin.readline().split())
    p = [int(x) for x in sys.stdin.readline().split()]
    (x, y) = ([], [])
    for _ in range(e):
        (a, b) = map(int, sys.stdin.readline().split())
        x.append(a)
        y.append(b)
        x.append(b)
        y.append(a)
    for a in p:
        x.append(a)
        y.append(n)
    if (not x):
        print(0)
        return
    c = ([1] * len(x))
    min_cut = maximum_flow(csr_matrix((c, (x, y)), ((n + 1), (n + 1))), source=0, sink=n).flow_value
    print(min_cut)