#include <iostream>
using namespace std;
int main()
{
int n;
string s;
cin >> n >> s;
int ans = 0;
for (int i = 0; s[i]; i++)
{
if (s[i] <= 90)
ans -= s[i];
else
ans += s[i] - 96;
}
cout << ans;
return 0;
}