#include<bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int main(){
	int n; string s; cin >> n >> s;
	map<char, int> cnt;
	rep(i, n) cnt[s[i++]]++;
	
	vi v;
	int ans = 0;
	for(auto p : cnt) v.pb(p.second);
	sort(all(v));
	rep(i, v.size()){
		if(i) ans++;
		if(v[i] == 1) { ans++; continue; }
		if(i + 1 < v.size() && v[i] == v[i + 1]){
			
			int j = i + 1;
			for(; j < v.size() && v[i] == v[j]; j++);
			ans += min(1 + 2 * (j - i + 1), 4 * (j - i) - 1);
			i = j - 1;
		}
		else ans += 3;
	}
	cout << ans <<endl;
	return 0;
}