ranks calculating