Let [n] = {1, 2, . . . , n} be a finite chain. Let Pn and Tn be the semigroups of partial and full transformations on [n], respectively. Let CPn = {α ∈ Pn : |xα-yα| ≤ |x-y| ∀x, y ∈ dom α} and CTn = {α ∈ Tn : |xα-yα| ≤ |x -y| ∀x, y ∈ [n]}. Then CPn and CTn are subsemigroups of Pn and Tn, respectively. In this paper, we characterize the idempotent elements and compute the number of idempotents of height n-1 and n-2 for the semigroups CPn and CTn, respectively.