import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as C

readInt' = fst.fromJust.C.readInt
readLnInt = map readInt'.C.words<$>C.getLine
readCsInt n = concat<$>replicateM n readLnInt

x ? (a,b) = if x then a else b
a~>(f,x) = [a] ++ (null x)?([],f x)
half = flip div 2
aliq = ((0==).).mod

main = do
 getLine
 inputs <- readLnInt
 print $ solve inputs

solve :: [Int] -> Int
solve s = length $ filter (==0) $ concat $ concat $ solve2 s

solve2 :: [Int] -> [[[Int]]]
solve2 [a] = [[[]]]
solve2 (a:b) = (solve3 a b)~>(solve2,b)

solve3 :: Int -> [Int] -> [[Int]]
solve3 a [b] = [[]]
solve3 a (b:c) = (solve4 (a,b) c)~>(solve3 a,c)

solve4 :: (Int,Int) -> [Int] -> [Int]
solve4 (a,b) (c:d) = ((judge [a,b,c])?(0,1))~>(solve4 (a,b),d)

judge [a,b,c] = bound [abs(a-b),c,a+b]
bound [a,b,c] = a<b && b<c
