#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    vector<int> A(3); rep(i, 3) cin >> A[i];
    sort(A.begin(), A.end());
    cout << A[1] + A[2] << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define int long long
int N;
char S[100'100];
int dp[100'100];
int mn[222];
signed main()
{
    cin.tie(0)->sync_with_stdio(false);
    memset(dp, 0x3F, sizeof dp);
    memset(mn, 0x3F, sizeof mn);
    dp[0] = 0;
    cin>>N;
    cin >>(S + 1);
    for (int i = 1; i <= N; ++i)
    {
        for (char c = 'a'; c <= 'z';++c)
        {
            if (c == S[i]) continue;
            dp[i] = min(dp[i], mn[c] + 1);
        }
        mn[S[i]] = min(mn[S[i]], dp[i - 1]);
    }
    if (dp[N] >= 1e9) cout << "-1\n";
    else cout << dp[N] << '\n';
    return 0;
}