#include<iostream>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<queue>
#include<algorithm>
#include<cstring>
using namespace std;
#define duke(i,a,n) for(int i = a;i <= n;i++)
#define lv(i,a,n) for(int i = a;i >= n;i--)
#define clean(a) memset(a,0,sizeof(a))
const int INF = 1 << 30;
typedef long long ll;
typedef double db;
template <class T>
void read(T &x)
{
char c;
bool op = 0;
while(c = getchar(), c < '0' || c > '9')
if(c == '-') op = 1;
x = c - '0';
while(c = getchar(), c >= '0' && c <= '9')
x = x * 10 + c - '0';
if(op) x = -x;
}
template <class T>
void write(T x)
{
if(x < 0) putchar('-'), x = -x;
if(x >= 10) write(x / 10);
putchar('0' + x % 10);
}
char s1[60],s2[60],s3[60];
int dp[100],l1,l2,l3;
int x,y,num = 0;
int ans1,ans2,ans3,ans;
int main()
{
read(l1);
scanf("%s",s1);
read(l2);
scanf("%s",s2);
read(l3);
scanf("%s",s3);
duke(i,0,min(l1,l2) - 1)
{
if(s1[i] == s2[i])
ans1++;
else
break;
}
duke(i,0,min(l1,l3) - 1)
{
if(s1[i] == s3[i])
ans2++;
else
break;
}
duke(i,0,min(l2,l3) - 1)
{
if(s2[i] == s3[i])
ans3++;
else
break;
}
if(ans1 >= max(ans2,ans3))
{
num = (l1 + l2 - 2 * ans1);
num += (l3 + ans1 - ans2 * 2);
}
else if(ans2 >= max(ans1,ans3))
{
num = (l1 + l3 - 2 * ans2);
// cout<<ans2<<endl;
num += (l2 + ans2 - ans3 * 2);
}
else
{
num = (l2 + l3 - 2 * ans3);
num += (l1 + ans3 - ans1 * 2);
}
printf("%d",num);
return 0;
}