x=gets.chomp.split(" ")
n=x[0].to_i
m=x[1].to_i
e=x[2].to_i

$N=n
$V=n+m
$G=Array.new($V).map{Array.new(0,0)}
$match=Array.new($V,-1);
$used=Array.new($V,false)

def add_edge(u,v)
    $G[u].push(v)
    $G[v].push(u)
end

def dfs(v)
    $used[v]=true
    for i in 0..$G[v].size-1
        u=$G[v][i]
        w=$match[u]
        if w<0 || !$used[w]&&dfs(w)==true
            $match[v]=u
            $match[u]=v
            return true
        end
    end
    return false 
end

def bipartite_matching()
    res=0
    $match.fill(-1,0..$V-1)
    for v in 0..$N-1
        if $match[v]<0
            $used.fill(false,0..$V-1)
            if dfs(v)==true
                res+=1
            end
        end
    end
    return res
end

for i in 1..e
    x=gets.chomp.split(" ")
    u=x[0].to_i
    v=x[1].to_i+n
    add_edge(u,v)
end
puts bipartite_matching()
