#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; int main(void){ int N; cin >> N; int cnt[101] = {0}; long long res = 0; for (int i = 0; i < N; i++) { int tmp; cin >> tmp; ++cnt[tmp]; } 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; }