#include #include #include #include using namespace std; template bool maxPointer(T& a, T b) { if (a < b) {a = b;return true;}return false;} template int maxReturn(T a, T b) {if (a > b) {return a;} else {return b;}} template bool minPointer(T& a, T b) {if (a < b) {a = b;return true;}return false;} const long mod = 1000000007; bool matuCheck(int a[], int i) { if ((a[i] > a[i-1] && a[i] > a[i+1]) || (a[i] < a[i-1] && a[i] < a[i+1])) { if (a[i] != a[i-1] && a[i] != a[i+1] && a[i-1] != a[i+1]) {return true;} } return false; } int main(void){ int N; cin >> N; int matu[N]; int cnt[101] = {0}; long long res = 0; for (int i = 0; i < N; i++) { cin >> matu[i]; ++cnt[matu[i]]; } for(int a = 0; a < 101; a++) for (int j = a+1; j < 101; j++) for (int s = j+1; s < 101; s++) res += (long long)(cnt[a] * cnt[j] * cnt[s]); cout << res % mod << endl; }