kr :: (Int -> Bool) -> [Int] -> Int -> [Int]
kr f [] _ = []
kr f [x] i = if f i then [x] else []
kr f (x:xs) i = (kr f [x] i) ++ (kr f xs (i+1))

main = do
    ns <- getLine
    ds <- getLine
    let n = read ns
    let d = map read $ words ds :: [Int]
    let f = (\x -> not $ x `elem` 0:[x*(n+1) | x <- [0..n-1]])
    print $ (sum $ kr f [x*y | x <- d, y<- d] 0) `div`2
