#!/bin/python3 import sys def minimumNumber(n, password): spe = "!@#$%^&*()-+" s = 0 l = 0 u = 0 d = 0 tot = 0 for i in password: k = ord(i) if i in spe: s += 1 elif k >= 65 and k <= 90: u += 1 elif k >= 97 and k <= 122: l += 1 elif k >= 48 and k <= 57: d += 1 if s == 0: tot += 1 if u == 0: tot += 1 if l == 0: tot += 1 if d == 0: tot += 1 #print(tot) if n < 6: total = 6 - n if total >= tot: return total else: return tot else: return tot if __name__ == "__main__": n = int(input().strip()) password = input().strip() answer = minimumNumber(n, password) print(answer)