Add missing <algorithm> include for std::min & std::max
Add missing <functional> include for std::greater
Make count less ambigous (Could be count or std::count)