Count pin positions correctly