using System; using System.Collections.Generic; using System.Linq; namespace Test { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); int ret = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { for (int k = j + 1; k < n; k++) { int[] a = new int[] { x[i],x[j],x[k] }; Array.Sort(a); if (a[1] != x[j] && x[i] != x[j] && x[j] != x[k]) ret++; } } } Console.WriteLine(ret); } } }