In many practical situations, we need to compute local maxima. In general, it is not algorithmically possible, given a computable function, to compute the locations of all its local maxima. We show, however, that if we know the number of local maxima, then such an algorithm is already possible. Interestingly, for global maxima, the situation is different: even if we only know the number of locations where the global maximum is attained, then, in general, it is not algorithmically possible to find all these locations. A similar impossibility result holds for local maxima if instead of knowing their exact number, we only know two possible numbers.