















open class Type(private val value:Int){
    override fun equals(other: Any?): Boolean {
        return when(other){
            is Type -> value and other.value != 0
            else -> super.equals(other)
        }
    }
    operator fun plus(other: Type): Type{
        return Type(value or other.value)
    }
    override fun toString(): String {
        return "Type($value)"
    }
}
object None: Type(0)
object A: Type(1)
object B: Type(2)
object C: Type(4)
fun main(args:Array<String>): Unit {
    val n = readLine()!!.toInt()
    val allMember = Array(n){None as Type}
    val memberA = readLine()!!.trim().split(' ').map(String::toInt).drop(1)
    val memberB = readLine()!!.trim().split(' ').map(String::toInt).drop(1)
    val memberC = readLine()!!.trim().split(' ').map(String::toInt).drop(1)
    for (a in memberA) allMember[a - 1] += A
    for (b in memberB) allMember[b - 1] += B
    for (c in memberC) allMember[c - 1] += C
    println(
            allMember.count{
                (it == C) && ((it != A) || (it == B))
            }
    )
}
