exercise 2.36 accumulate-n