output_description: If it is possible to change S into `AKIHABARA`, print `YES`; otherwise, print
  `NO`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
attempt: from collections import Counter 
  import itertools
  
  N = int(input())
  D = list(map(int, input().split()))
  M = Counter(D)
  if max(M.values()) > 2:
      print(0)from collections import Counter 
  import itertools
  
  N = int(input())
  D = list(map(int, input().split()))
  M = Counter(D)
  if max(M.values()) > 2:
      print(0)
  else:
      D = [[x, 24-x] for x in D]
      generator = list(itertools.product([0, 1], repeat=N))
      D_gen = [[D[i][g[i]] for i in range(N)] for g in generator]
      ans = 0
      for d in D_gen:
          tmp = [0] + sorted(d) + [24]
          s = 13
          for i in range(N+1):
              s = min(s, tmp[i+1]-tmp[i])
          ans = max(ans, s)
      print(ans)
  
  elif 0 in D:
      print(0)
  else:
      D = [[x, 24-x] for x in D]
      generator = list(itertools.product([0, 1], repeat=N))
      D_gen = [[D[i][g[i]] for i in range(N)] for g in generator]
      ans = 0
      for d in D_gen:
          tmp = [0] + sorted(d) + [24]
          s = 13
          for i in range(N+1):
              s = min(s, tmp[i+1]-tmp[i])
          ans = max(ans, s)
      print(ans)
  
problem_description: Statement
  
  You are given a string S.
  
  Takahashi can insert the character `A` at any position in this string any
  number of times.
  
  Can he change S into `AKIHABARA`?
samples: [{"input": "KIHBR", "output": "YES\n    \n\nInsert one `A` at each of the four positions: the beginning, immediately after\n`H`, immediately after `B` and the end.\n\n* * *"}, {"input": "AKIBAHARA", "output": "NO\n    \n\nThe correct spell is `AKIHABARA`.\n\n* * *"}, {"input": "AAKIAHBAARA", "output": "NO"}]