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[] As = new int[100]; for (int i = 0; i < N; i++) { As[sc.nextInt() - 1]++; } sc.close(); long ans = 0; for (int i = 0; i < As.length; i++) { for (int j = i + 1; j < As.length; j++) { for (int k = j + 1; k < As.length; k++) { ans += As[i] * As[j] * As[k]; ans %= MOD; } } } System.out.println(ans); } }