Created
April 2, 2017 23:14
-
-
Save fhorlaville/188da43bef4ee81c5406fdc2dc1dd855 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let n = Int(readLine()!)! | |
let line0 = readLine()!.components(separatedBy: " ").map{ Int($0)! }.sorted(by: { $0 > $1 }) | |
var answer = 0 | |
var previous = line0[0] | |
for i in 0..<n { | |
if line0[i] == previous { | |
answer += 1 | |
previous = line0[i] | |
} else { | |
break | |
} | |
} | |
print(answer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment