Stellar CN band strengths and the abundance of nitrogen