calculate the dimension of the list