On counting medals
The convention used by the IOC is to sort by the number of gold medals the athletes from a country have earned. In the event of a tie in the number of gold medals, the number of silver medals is considered, and then the number of bronze medals. If two countries have an equal number of gold, silver, and bronze medals, they are ordered in the table alphabetically by their IOC country code. Others decide to sort according to the total number of medals—quality vs quantity. As a German, I have preferred the IOC method.