Company: codesignal
Difficulty: easy
Rob, an Uber driver known for his kindness and willingness to help fellow drivers, finds himself in a situation where he has n drivers seeking support. Each of these drivers has a rating. Rob's criteria for offering support are specific: he will only support a driver if there is at least one other driver with a strictly lower rating and at least one other driver with a strictly higher rating. Determine how many drivers Rob can help. Input Format The first line contains a single integer n - the number of drivers with Rob. The second line contains n integers d 1 , d 2 , ..., d n representing the ratings associated with the drivers. Output Format A single integer representing the number of drivers that Rob can help. Constraints 1 ≤ n ≤ 10 5 0 ≤ d i ≤ 10 9 Sample Input 1 3 1 2 3 Sample Output 1 1 Explanation: 2 is the only rating with at least one lesser and at least one higher rating, hence the output is 1. Sample Input 2 5 5 3 1 4 2 Sample Output 2 3 Explanation: The ratings