import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int []cnt = new int[101]; Arrays.fill(cnt, 0); for(int i = 0; i < N; i++) { cnt[scan.nextInt()]++; } scan.close(); long d = 1000000007; 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++) { if(cnt[i] != 0 && cnt[j] != 0 && cnt[k] != 0) { ans += (cnt[i] * cnt[j] * cnt[k]) % d; } } } } System.out.println(ans); } }