package main import ( "fmt" "math" "sort" ) func MaxInt(x ...int) int { ret := x[0] for i := 1; i < len(x); i++ { ret = int(math.Max(float64(ret), float64(x[i]))) } return ret } func MinInt(x ...int) int { ret := x[0] for i := 1; i < len(x); i++ { ret = int(math.Min(float64(ret), float64(x[i]))) } return ret } func AbsInt(x int) int { return int(math.Abs(float64(x))) } func SortInt(x ...int) { sort.Sort(sort.IntSlice(x)) } func SortReverseInt(x ...int) { sort.Sort(sort.Reverse(sort.IntSlice(x))) } func resolve(N int, A []int) int { ret := 0 for i := 0; i < N-2; i++ { for j := i + 1; j < N-1; j++ { for k := j + 1; k < N; k++ { if A[i] == A[j] || A[j] == A[k] || A[k] == A[i] { continue } ret += 1 } } } return ret % (int(math.Pow(10, 9) + 7)) } func main() { var N int fmt.Scanf("%d\n", &N) A := make([]int, N) for i := 0; i < N; i++ { fmt.Scanf("%d", &A[i]) } fmt.Println(resolve(N, A)) }