Last@SortBy[ Table[ {n, Length@ProperDivisors[n]}, {n, 1, 20000}], Last]