import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val s = sc.next()
    val t = sc.next()

    var overlap = 0
    for (i in n downTo 0) {
        if (s.slice(n - i until n) == t.slice(0 until i)) {
            overlap = i
            break
        }
    }
    println(2 * n - overlap)
}
