N=int(input()) S = list(str(input().rstrip())) v=int(input()) true_sum=0 for i in range(N): true_sum += int(S[i]) print(true_sum-v)