adding function to calculate number of towers