/* really fast io programming: http://abhisharlives.blogspot.com/2012/06/really-fast-io-methods-for-programming.html why c<48 and c>57 https://www.quora.com/Why-is-the-value-of-char-value-48-a-zero; https://www.quora.com/How-and-when-do-I-use-getchar_unlocked-in-C */ #include #include #define gcx getchar_unlocked using namespace std; int fast_scan() { int c = gcx(); int x = 0; for(;(c<48 || c>57);c = gcx()); for(;c>47 && c<58;c = gcx()) { x = (x<<1) + (x<<3) + c - 48; } return x; } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n;//no of candles n=fast_scan(); int max_h=-1; int count=1; while(n>0){ int temp; temp=fast_scan(); if(temp>max_h){ max_h=temp; count=1; } else if(temp==max_h) count++; n--; } printf("%d",count); return 0; }