the rank function for corners ids