#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <functional> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <valarray> #include <vector> #define N 1000 #define MOD 1000000007 #define pe(str) return cout<<(str)<<endl,0 #define px(str) {cout<<(str)<<endl;exit(0);} #define re(i,n) for(int i=0;i<(n);i++) #define rep(i,a,b) for(int i=(a);i<(b);i++) #define fe(i,n,f) for_each(i,n,f) #define bw(a,b,c) (((a)<=(b))&&((b)<=(c))) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int,int> pii; int main(void){ int n; ll a[101]={0}; int k; ll s=0; cin>>n; re(i,n)cin>>k,a[k]++; rep(i,1,101){ rep(j,i+1,101){ rep(k,j+1,101){ s+=(a[i]*a[j]*a[k]); s%=MOD; } } } cout<<s<<endl; return 0; }