output_description: Print the largest possible number of different letters contained in both X and
  Y.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      S
attempt: def examB():
      N = I()
      S = SI()
      cur = 0
      for i in range(N - 1):
          d1 = set()
          d2 = set()
          for j in S[:i]:
              d1.add(j)
          for j in S[i:]:
              d2.add(j)
          curS = d1 & d2
          cur = max(cur, len(curS))
      print(cur)
  
  
  import sys, copy, bisect, itertools, heapq, math
  from heapq import heappop, heappush, heapify
  from collections import Counter, defaultdict, deque
  
  
  def I():
      return int(sys.stdin.readline())
  
  
  def LI():
      return list(map(int, sys.stdin.readline().split()))
  
  
  def LSI():
      return list(map(str, sys.stdin.readline().split()))
  
  
  def LS():
      return sys.stdin.readline().split()
  
  
  def SI():
      return sys.stdin.readline().strip()
  
  
  mod = 10**9 + 7
  inf = float("inf")
  
  examB()
  
problem_description: Statement
  
  You are given a string S of length N consisting of lowercase English letters.
  We will cut this string at one position into two strings X and Y. Here, we
  would like to maximize the number of different letters contained in both X and
  Y. Find the largest possible number of different letters contained in both X
  and Y when we cut the string at the optimal position.
samples: [{"input": "6\n    aabbca", "output": "2\n    \n\nIf we cut the string between the third and fourth letters into X = `aab` and Y\n= `bca`, the letters contained in both X and Y are `a` and `b`. There will\nnever be three or more different letters contained in both X and Y, so the\nanswer is 2.\n\n* * *"}, {"input": "10\n    aaaaaaaaaa", "output": "1\n    \n\nHowever we divide S, only `a` will be contained in both X and Y.\n\n* * *"}, {"input": "45\n    tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir", "output": "9"}]