fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val ss = readLine()!!
    val tt = readLine()!!

    var merged = ss.length

    while (merged > 0) {
        if (merged > tt.length) {
            merged--
            continue
        }

        if (ss.takeLast(merged) == tt.take(merged)) {
            break
        }

        merged--
    }

    println(ss.length + tt.length - merged)
}

