new amount_neighbors function