output_description: Print the number of the subsequences such that all characters are different,
  modulo 10^9+7.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      S
attempt: import math
  import copy
  
  
  def nCast(number):
      if type(number) == str:
          return int(number)
      for idx in range(0, len(number)):
          if type(number[idx]) == str:
  
              number[idx] = int(number[idx])
          else:
              nCast(number[idx])
      return number
  
  
  def inputArr(w):
      l = list()
      for idx in range(0, w):
          l.append(input())
      return l
  
  
  def inputArr1(w):
      l = list()
      for idx in range(0, w):
          l.append(input().split())
      return l
  
  
  n = input()
  s = input()
  
  mod = 1000000007
  
  
  def help1(a):
      all = 0
      a1 = 1
      a2 = 1
  
      b1 = 1
      while a != 0:
          a1 = a1 * a
          a2 = a2 * b1
          b1 += 1
          tmp = (int)(a1 / a2)
          a = a - 1
          all = (all + tmp) % mod
      return all
  
  
  def func():
      count = help1(len(s))
      dic = {}
  
      for c in s:
          if c in dic:
              dic[c] = dic[c] + 1
          else:
              dic[c] = 1
      res = len(s)
      l = []
      for k in dic:
          if dic[k] == 1:
              l.append(k)
      for obj in l:
          del dic[obj]
  
      count2 = 1
      sum1 = 0
      for k in dic:
          sum1 += dic[k]
          count2 = count2 * (1 + dic[k])
  
      number3 = help1(sum1) - count2 + 1
  
      number4 = help1(len(s) - sum1) + 1
  
      number3 = number3 * number4
      return count - number3
  
  
  print(func())
  
problem_description: Statement
  
  You are given a string S of length N. Among its subsequences, count the ones
  such that all characters are different, modulo 10^9+7. Two subsequences are
  considered different if their characters come from different positions in the
  string, even if they are the same as strings.
  
  Here, a subsequence of a string is a concatenation of **one or more**
  characters from the string without changing the order.
samples: [{"input": "4\n    abcd", "output": "15\n    \n\nSince all characters in S itself are different, all its subsequences satisfy\nthe condition.\n\n* * *"}, {"input": "3\n    baa", "output": "5\n    \n\nThe answer is five: `b`, two occurrences of `a`, two occurrences of `ba`. Note\nthat we do not count `baa`, since it contains two `a`s.\n\n* * *"}, {"input": "5\n    abcab", "output": "17"}]