Average an array