#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; bool is_valid_height(int value){ return (value >= 1 && (value <= pow(10, 7))); } int highest(vector& candles){ vector::iterator last, first; first = candles.begin(); last = candles.end(); int highest = *first; while (first != last){ if (*first > highest && is_valid_height(highest)) highest = *first; ++first; } return highest; } int match_height(int highest_candle, const vector& candles){ int matches = 0; for_each(candles.begin(), candles.end(), [&](int height){if (height == highest_candle){ ++matches; }}); return matches; } int main(){ int n; cin >> n; vector height(n); for(int height_i = 0;height_i < n;height_i++){ cin >> height[height_i]; } cout << match_height(highest(height),height) << endl; return 0; }