연습문제 5-4: add method for calculating number of specific pieces