summ = 0
b = int(input())
a = input()
for i in a:
if 'A'<=i<='Z':
summ += -(ord(i))
else:
summ+=ord(i)-96
print(summ)
# JalenLam_progamer
# IQ380