#include <bits/stdc++.h>
using namespace std;

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

void solve() {
  int n;
  cin >> n;
  string a, b;
  cin >> a >> b;
  for (int i = 0; i < n; i++) {
    int f = 0;
    for (int j = 0; i + j < n; j++) {
      if (a[j + i] != b[j]) {
        f = 1;
        break;
      }
    }
    if (!f) {
      cout << n + i << '\n';
      return;
    }
  }
  cout << n + n << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) solve();
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int N;
    cin >> N;
    string s;
    cin >> s;
    string t;
    cin >> t;
    int max_length = 0;
    for (int i = 1; i <= N; i++){
        if (s.substr(N - i, i) == t.substr(0, i)) max_length = i;
    }
    cout << 2 * N - max_length << endl;
}
