Sharp bound on the number of maximal sum