Maximum order of triangle-free graphs with a given rank