def triangle(N, Ls):
  result = 0
  res = []
  numbers = {}
  edgeLength = list(set(Ls))
  for i in edgeLength:
    numbers[i] = Ls.count(i)
  for i in range(len(edgeLength)):
    a = edgeLength[i]   
    copy1 = edgeLength[i+1:]
    for j in range(len(copy1)):
      b = copy1[j]
      copy2 = copy1[j+1:]
      for k in range(len(copy2)):
        c = copy2[k]
        if a + b > c and b + c > a and c + a > b:
          res.append([a, b, c])
  for val in res:
    result += numbers[val[0]] * numbers[val[1]] * numbers[val[2]]
  return result




if __name__ == "__main__":
  N = list(map(int, input().split()))
  Ls = list(map(int, input().split()))
  print(triangle(N, Ls)) def triangle(N, Ls):
  result = 0
  res = []
  numbers = {}
  edgeLength = list(set(Ls))
  for i in edgeLength:
    numbers[i] = Ls.count(i)
  for i in range(len(edgeLength)):
    a = edgeLength[i]   
    copy1 = edgeLength[i+1:]
    for j in range(len(copy1)):
      b = copy1[j]
      copy2 = copy1[j+1:]
      for k in range(len(copy2)):
        c = copy2[k]
        if a + b > c and b + c > a and c + a > b:
          res.append([a, b, c])
  for val in res:
    result += numbers[val[0]] * numbers[val[1]] * numbers[val[2]]
  return result triangle result = 0 result 0 res = [] res [] numbers = {} numbers {} edgeLength = list(set(Ls)) edgeLength list(set(Ls)) list set(Ls) set Ls for i in edgeLength:
    numbers[i] = Ls.count(i)
   i edgeLength numbers[i] = Ls.count(i) numbers[i] numbers i Ls.count(i) Ls.count Ls count i for i in range(len(edgeLength)):
    a = edgeLength[i]   
    copy1 = edgeLength[i+1:]
    for j in range(len(copy1)):
      b = copy1[j]
      copy2 = copy1[j+1:]
      for k in range(len(copy2)):
        c = copy2[k]
        if a + b > c and b + c > a and c + a > b:
          res.append([a, b, c])
   i range(len(edgeLength)) range len(edgeLength) len edgeLength a = edgeLength[i] a edgeLength[i] edgeLength i copy1 = edgeLength[i+1:] copy1 edgeLength[i+1:] edgeLength i+1: i+1 i 1 for j in range(len(copy1)):
      b = copy1[j]
      copy2 = copy1[j+1:]
      for k in range(len(copy2)):
        c = copy2[k]
        if a + b > c and b + c > a and c + a > b:
          res.append([a, b, c])
   j range(len(copy1)) range len(copy1) len copy1 b = copy1[j] b copy1[j] copy1 j copy2 = copy1[j+1:] copy2 copy1[j+1:] copy1 j+1: j+1 j 1 for k in range(len(copy2)):
        c = copy2[k]
        if a + b > c and b + c > a and c + a > b:
          res.append([a, b, c])
   k range(len(copy2)) range len(copy2) len copy2 c = copy2[k] c copy2[k] copy2 k if a + b > c and b + c > a and c + a > b:
          res.append([a, b, c])
   a + b > c and b + c > a and c + a > b a + b > c and b + c > a a + b > c a + b a b c b + c > a b + c b c a c + a > b c + a c a b res.append([a, b, c]) res.append res append [a, b, c] a b c for val in res:
    result += numbers[val[0]] * numbers[val[1]] * numbers[val[2]]
   val res result += numbers[val[0]] * numbers[val[1]] * numbers[val[2]] result numbers[val[0]] * numbers[val[1]] * numbers[val[2]] numbers[val[0]] * numbers[val[1]] numbers[val[0]] numbers val[0] val 0 numbers[val[1]] numbers val[1] val 1 numbers[val[2]] numbers val[2] val 2 return result result N N Ls Ls if __name__ == "__main__":
  N = list(map(int, input().split()))
  Ls = list(map(int, input().split()))
  print(triangle(N, Ls)) __name__ == "__main__" __name__ "__main__" N = list(map(int, input().split())) N list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split Ls = list(map(int, input().split())) Ls list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split print(triangle(N, Ls)) print triangle(N, Ls) triangle N Ls def triangle(N, Ls):
  result = 0
  res = []
  numbers = {}
  edgeLength = list(set(Ls))
  for i in edgeLength:
    numbers[i] = Ls.count(i)
  for i in range(len(edgeLength)):
    a = edgeLength[i]   
    copy1 = edgeLength[i+1:]
    for j in range(len(copy1)):
      b = copy1[j]
      copy2 = copy1[j+1:]
      for k in range(len(copy2)):
        c = copy2[k]
        if a + b > c and b + c > a and c + a > b:
          res.append([a, b, c])
  for val in res:
    result += numbers[val[0]] * numbers[val[1]] * numbers[val[2]]
  return result def triangle(N, Ls):
  result = 0
  res = []
  numbers = {}
  edgeLength = list(set(Ls))
  for i in edgeLength:
    numbers[i] = Ls.count(i)
  for i in range(len(edgeLength)):
    a = edgeLength[i]   
    copy1 = edgeLength[i+1:]
    for j in range(len(copy1)):
      b = copy1[j]
      copy2 = copy1[j+1:]
      for k in range(len(copy2)):
        c = copy2[k]
        if a + b > c and b + c > a and c + a > b:
          res.append([a, b, c])
  for val in res:
    result += numbers[val[0]] * numbers[val[1]] * numbers[val[2]]
  return result triangle N = list(map(int, input().split())) list(map(int, input().split())) N Ls = list(map(int, input().split())) list(map(int, input().split())) Ls
def triangle(N, Ls):
  result = 0
  res = []
  numbers = {}
  edgeLength = list(set(Ls))
  for i in edgeLength:
    numbers[i] = Ls.count(i)
  for i in range(len(edgeLength)):
    a = edgeLength[i]   
    copy1 = edgeLength[i+1:]
    for j in range(len(copy1)):
      b = copy1[j]
      copy2 = copy1[j+1:]
      for k in range(len(copy2)):
        c = copy2[k]
        if a + b > c and b + c > a and c + a > b:
          res.append([a, b, c])
  for val in res:
    result += numbers[val[0]] * numbers[val[1]] * numbers[val[2]]
  return result




if __name__ == "__main__":
  N = list(map(int, input().split()))
  Ls = list(map(int, input().split()))
  print(triangle(N, Ls))
