Retrieve Current logged in user and then logged in user associated list of courses and then from this courses list take Count and check it.
If you can explain how the association exist between Account/User and Courses, it would be more clear to provide solution