×*§Ġ~ȧL
Try it Online!
Unlike all the other answers, this sort of visually solves the problem. Let me show you how:
Explained
×*§Ġ~ȧL
×* # Push n asterisks for each n in the input
§ # The magic. Vertically join the list (that is, transpose, join on newlines, filling with spaces)
Ġ # Group by consecutive characters
~ȧ # And remove those which are just whitespace
L # Get the length of that list
💎
Created with the help of Luminespire.
Given an input of [1,3,2,1,2,1,5,3,3,4,2]
, it first becomes:
["*", "***", "**", "*", "**", "*", "*****", "***", "***", "****", "**"]
Then, we create the skyline:
*
* *
* ****
** * *****
***********
From here, we can find each unique cluster of asterisks.
(*)
(*) (*)
(*) (****)
(**) (*) (*****)
(***********)
(The answer doesn't insert the brackets, but it does do the grouping part). Count the number of clusters, and you get the required answer.