#!/bin/python import sys def minimumNumber(n, pas): # Return the minimum number of characters to make the password strong numbers = "0123456789" low = "abcdefghijklmnopqrstuvwxyz" up = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" sp = "!@#$%^&*()-+" c1=c2=c3=c4=1 for i in range(n): if pas[i] in numbers: c1=0 elif pas[i] in low: c2=0 elif pas[i] in up: c3=0 elif pas[i] in sp: c4=0 s=c1+c2+c3+c4 if n+s<6: s+=(6-n-s) return s if __name__ == "__main__": n = int(raw_input().strip()) password = raw_input().strip() answer = minimumNumber(n, password) print answer