def main(): n = int(input()) a = [int(i) for i in input().split(" ")] sorted_a = sorted(a) count = 0 if n >= 3: for i in range(1, n - 1): if sorted_a[i] != sorted_a[i + 1] and sorted_a[i] != sorted_a[i - 1]: count += 1 if sorted_a[0] != sorted_a[1] or sorted_a[n - 2] != sorted_a[n - 1]: count += 1 print(count) if __name__ == "__main__": main()