Sort tags and print totals.