Split on the last piece

Sort every arrangement by how it ends, and a big count becomes a sum of smaller counts of the same kind.