object Main extends App {
  val sc = new java.util.Scanner(System.in)
  println {
    List
      .fill(sc.nextInt())(sc.nextLong())
      .groupBy(identity)
      .toList
      .sortBy(_._1)
      .combinations(3)
      .map { case l@List((a, _), (b, _), (c, _)) =>
        if (a + b <= c) 0 else l.foldLeft(1)(_ * _._2.size)
      }
      .sum
  }
}