import java.util.Scanner; class Main { private static final int MOD = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] kado_kinds = new int[101]; for (int i = 0; i < N; i++) { int length = sc.nextInt(); kado_kinds[length]++; } sc.close(); long ans = 0; for (int i = 1; i <= 100; i++) { for (int j = i + 1; j <= 100; j++) { for (int k = j + 1; k <= 100; k++) { int kake = kado_kinds[i] * kado_kinds[j] * kado_kinds[k]; ans = ans + kake; ans = ans % MOD; } } } System.out.println(ans); } }