The Hilbert-Kunz function of rings of finite Cohen-Macaulay type