import Control.Monad
import Control.Applicative
import Data.List


  
main :: IO ()
main = do
  jnput <- getLine
  input <- getLine
  let lenm = map read (words input ) :: [Int] 
  let len = sort lenm
  putStrLn (show(solve len))


solve :: [Int] -> Int
solve len 
  | ((length len) == 0) = 0
  | otherwise = (solvei  (tail len) (head len))+(solve (tail len) )

solvei :: [Int] -> Int -> Int
solvei len x 
  | ((length len) == 0) = 0
  | otherwise = (solveij  (tail len) x (head len))+(solvei (tail len) x )

solveij :: [Int] -> Int -> Int -> Int
solveij len x y 
  | ((length len) == 0) = 0
  | otherwise = (solveijk  x y (head len))+(solveij (tail len) x y)

solveijk ::  Int -> Int -> Int -> Int
solveijk x y z 
  | x==y =0
  | y==z =0
  | (x+y)<=z =0
  | otherwise = 1

