main :: IO ()
main = do 
    -- takes in an integer
    n <- readLn :: IO Int
    -- takes in a list (String IO)
    nm <- getLine
    putStrLn $ show (getSkew (readasInt nm) n)


readasInt :: String -> [Int]
readasInt [] = []
readasInt xs = foldl (\acc x -> (read [x] :: Int) : acc) [] xs

getSkew :: [Int] -> Int -> Int
getSkew x 0 = 0
getSkew (x:y:xs) n = y + getSkew xs (n-1)



-- Quick Sort Function
quickSort :: (Ord a) => [a] -> [a]
quickSort [] = []
quickSort (x:xs) = 
    let smallSorted = [n | n <- xs, x >= n]
        bigSorted   = [n | n <- xs, x < n]
    in quickSort smallSorted ++ [x] ++ quickSort bigSorted