Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim N As Integer = CInt(NextString())
        Dim s As String = NextString()
        Dim t As String = NextString()

        Dim ans As Integer = N

        For i As Integer = 0 To N - 1
            Dim flg As Boolean = False
            For j As Integer = 0 To N - 1 - i
                If s(i + j) <> t(j) Then
                    ans += 1
                    flg = True
                    Exit For
                End If
            Next
            If Not flg Then Exit For
        Next

        WriteLine(ans)
    End Sub

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module
