calculates popularity