#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define _CRT_SECURE_NO_WARNINGS
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>

#ifdef LOCAL
# include <opencv2/core/core.hpp>
# include <opencv2/highgui/highgui.hpp>
# include <opencv2/imgproc/imgproc.hpp>
#endif

using namespace std;

// Let's define unordered map
# ifdef __GNUC__
# if __cplusplus > 199711L
# include <unordered_set>
# include <unordered_map>
# else
# include <tr1/unordered_map>
# include <tr1/unordered_set>
using namespace tr1;
# endif
# else
# include <unordered_map>
# include <unordered_set>
# endif

#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 6,5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,_6,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define DBN1(a)           cerr<<#a<<"="<<(a)<<"\n"
#define DBN2(a,b)         cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBN3(a,b,c)       cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define DBN4(a,b,c,d)     cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e)   cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN6(a,b,c,d,e,f) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<", "<<#f<<"="<<(f)<<"\n"
#define DBN(...) macro_dispatcher(DBN, __VA_ARGS__)(__VA_ARGS__)
#define DA(a,n) cerr<<#a<<"=["; printarray(a,n); cerr<<"]\n"
#define DAR(a,n,s) cerr<<#a<<"["<<s<<"-"<<n-1<<"]=["; printarray(a,n,s); cerr<<"]\n"

#ifdef _MSC_VER
#define PREFETCH(ptr, rw, level) ((void)0)
#else
#define PREFETCH(ptr, rw, level) __builtin_prefetch(ptr, rw, level)
#endif

#ifdef LOCAL
#define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl
#else
#define CURTIME()
#endif

#define mp make_pair
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef int itn;

template<class T1, class T2, class T3>
struct triple{ T1 a; T2 b; T3 c; triple() : a(T1()), b(T2()), c(T3()) {}; triple(T1 _a, T2 _b, T3 _c) :a(_a), b(_b), c(_c){} };
template<class T1, class T2, class T3>
bool operator<(const triple<T1,T2,T3>&t1,const triple<T1,T2,T3>&t2){if(t1.a!=t2.a)return t1.a<t2.a;else if(t1.b!=t2.b)return t1.b<t2.b;else return t1.c<t2.c;}
template<class T1, class T2, class T3>
bool operator>(const triple<T1,T2,T3>&t1,const triple<T1,T2,T3>&t2){if(t1.a!=t2.a)return t1.a>t2.a;else if(t1.b!=t2.b)return t1.b>t2.b;else return t1.c>t2.c;}
#define tri triple<int,int,int>
#define trll triple<ll,ll,ll>

#define FI(n) for(int i=0;i<(n);++i)
#define FJ(n) for(int j=0;j<(n);++j)
#define FK(n) for(int k=0;k<(n);++k)
#define FL(n) for(int l=0;l<(n);++l)
#define FQ(n) for(int q=0;q<(n);++q)
#define FOR(i,a,b) for(int i = (a), __e = (int) (b); i < __e; ++i)
#define all(a) std::begin(a), std::end(a)
#define reunique(v) v.resize(std::unique(v.begin(), v.end()) - v.begin())

#define sqr(x) ((x) * (x))
#define sqrt(x) sqrt(1.0 * (x))
#define pow(x, n) pow(1.0 * (x), n)

#define COMPARE(obj) [&](const std::decay_t<decltype(obj)>& a, const std::decay_t<decltype(obj)>& b)
#define COMPARE_BY(obj, field) [&](const std::decay_t<decltype(obj)>& a, const std::decay_t<decltype(obj)>& b) { return a.field < b.field; }

#define checkbit(n, b) (((n) >> (b)) & 1)
#define setbit(n, b) ((n) | (static_cast<std::decay<decltype(n)>::type>(1) << (b)))
#define removebit(n, b) ((n) & ~(static_cast<std::decay<decltype(n)>::type>(1) << (b)))
#define flipbit(n, b) ((n) ^ (static_cast<std::decay<decltype(n)>::type>(1) << (b)))
inline int countBits(uint v){v=v-((v>>1)&0x55555555);v=(v&0x33333333)+((v>>2)&0x33333333);return((v+(v>>4)&0xF0F0F0F)*0x1010101)>>24;}
inline int countBits(ull v){uint t=v>>32;uint p=(v & ((1ULL << 32) - 1)); return countBits(t) + countBits(p); }
inline int countBits(ll v){return countBits((ull)v); }
inline int countBits(int v){return countBits((uint)v); }
unsigned int reverseBits(uint x){ x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
template<class T> inline int sign(T x){ return x > 0 ? 1 : x < 0 ? -1 : 0; }
inline bool isPowerOfTwo(int x){ return (x != 0 && (x&(x - 1)) == 0); }
constexpr ll power(ll x, int p) { return p == 0 ? 1 : (x * power(x, p - 1)); }
//template<class T1, class T2, class T3> T1 inline clamp(T1 x, const T2& a, const T3& b) { if (x < a) return a; else if (x > b) return b; else return x; }
unsigned long long rdtsc() { unsigned long long ret = 0;
#ifdef __clang__
    return __builtin_readcyclecounter();
#endif
#ifndef _MSC_VER
    asm volatile("rdtsc" : "=A" (ret) : :);
#endif
    return ret; }
// Fast IO ********************************************************************************************************
const int __BS = 4096;
static char __bur[__BS + 16], *__er = __bur + __BS, *__ir = __er;
template<class T = int> T readInt() {
    auto c = [&]() { if (__ir == __er) std::fill(__bur, __bur + __BS, 0), cin.read(__bur, __BS), __ir = __bur; };
    c(); while (*__ir && (*__ir < '0' || *__ir > '9') && *__ir != '-') ++__ir; c();
    bool m = false; if (*__ir == '-') ++__ir, c(), m = true;
    T r = 0; while (*__ir >= '0' && *__ir <= '9') r = r * 10 + *__ir - '0', ++__ir, c();
    ++__ir; return m ? -r : r;
}
static char __buw[__BS + 20], *__iw = __buw, *__ew = __buw + __BS;
template<class T>
void writeInt(T x, char endc = '\n') {
    if (x < 0) *__iw++ = '-', x = -x; if (x == 0) *__iw++ = '0';
    char* s = __iw;
    while (x) { T t = x / 10; char c = x - 10 * t + '0'; *__iw++ = c; x = t; }
    char* f = __iw - 1; while (s < f) swap(*s, *f), ++s, --f;
    if (__iw > __ew) cout.write(__buw, __iw - __buw), __iw = __buw;
    *__iw++ = endc;
}
template<class T>
void writeStr(const T& str) {
    int i = 0; while (str[i]) { *__iw++ = str[i++]; if (__iw > __ew) cout.write(__buw, __iw - __buw), __iw = __buw; }
}
struct __FL__ { ~__FL__() { if (__iw != __buw) cout.write(__buw, __iw - __buw); } };
static __FL__ __flushVar__;

//STL output *****************************************************************************************************
#define TT1 template<class T>
#define TT1T2 template<class T1, class T2>
#define TT1T2T3 template<class T1, class T2, class T3>
TT1T2 ostream& operator << (ostream& os, const pair<T1, T2>& p);
TT1 ostream& operator << (ostream& os, const vector<T>& v);
TT1T2 ostream& operator << (ostream& os, const set<T1, T2>&v);
TT1T2 ostream& operator << (ostream& os, const multiset<T1, T2>&v);
TT1T2 ostream& operator << (ostream& os, priority_queue<T1, T2> v);
TT1T2T3 ostream& operator << (ostream& os, const map<T1, T2, T3>& v);
TT1T2T3 ostream& operator << (ostream& os, const multimap<T1, T2, T3>& v);
TT1T2T3 ostream& operator << (ostream& os, const triple<T1, T2, T3>& t);
template<class T, size_t N> ostream& operator << (ostream& os, const array<T, N>& v);
TT1T2 ostream& operator << (ostream& os, const pair<T1, T2>& p){ return os <<"("<<p.first<<", "<< p.second<<")"; }
TT1 ostream& operator << (ostream& os, const vector<T>& v){       bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
template<class T, size_t N> ostream& operator << (ostream& os, const array<T, N>& v) {     bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const set<T1, T2>&v){    bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const multiset<T1,T2>&v){bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
TT1T2T3 ostream& operator << (ostream& os, const map<T1,T2,T3>& v){ bool f = 1; os << "["; for (auto& ii : v) { if (!f)os << ", "; os << "(" << ii.first << " -> " << ii.second << ") "; f = 0; }return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const multimap<T1, T2>& v){ bool f = 1; os << "["; for (auto& ii : v) { if (!f)os << ", "; os << "(" << ii.first << " -> " << ii.second << ") "; f = 0; }return os << "]"; }
TT1T2 ostream& operator << (ostream& os, priority_queue<T1, T2> v) { bool f = 1; os << "["; while (!v.empty()) { auto x = v.top(); v.pop(); if (!f) os << ", "; f = 0; os << x; } return os << "]"; }
TT1T2T3 ostream& operator << (ostream& os, const triple<T1, T2, T3>& t){ return os << "(" << t.a << ", " << t.b << ", " << t.c << ")"; }
TT1T2 void printarray(const T1& a, T2 sz, T2 beg = 0){ for (T2 i = beg; i<sz; i++) cout << a[i] << " "; cout << endl; }

//STL input *****************************************************************************************************
TT1T2T3 inline istream& operator >> (istream& os, triple<T1, T2, T3>& t);
TT1T2 inline istream& operator >> (istream& os, pair<T1, T2>& p) { return os >> p.first >> p.second; }
TT1 inline istream& operator >> (istream& os, vector<T>& v) {
    if (v.size()) for (T& t : v) os >> t; else {
        string s; T obj; while (s.empty()) {getline(os, s); if (!os) return os;}
        stringstream ss(s); while (ss >> obj) v.push_back(obj);
    }
    return os;
}
TT1T2T3 inline istream& operator >> (istream& os, triple<T1, T2, T3>& t) { return os >> t.a >> t.b >> t.c; }

//Pair magic *****************************************************************************************************
#define PT1T2 pair<T1, T2>
TT1T2 inline PT1T2 operator+(const PT1T2 &p1 , const PT1T2 &p2) { return PT1T2(p1.first + p2.first, p1.second + p2.second); }
TT1T2 inline PT1T2& operator+=(PT1T2 &p1 , const PT1T2 &p2) { p1.first += p2.first, p1.second += p2.second; return p1; }
TT1T2 inline PT1T2 operator-(const PT1T2 &p1 , const PT1T2 &p2) { return PT1T2(p1.first - p2.first, p1.second - p2.second); }
TT1T2 inline PT1T2& operator-=(PT1T2 &p1 , const PT1T2 &p2) { p1.first -= p2.first, p1.second -= p2.second; return p1; }

#undef TT1
#undef TT1T2
#undef TT1T2T3

#define FREIN(FILE) freopen(FILE, "rt", stdin)
#define FREOUT(FILE) freopen(FILE, "wt", stdout)
#ifdef LOCAL
#define BEGIN_PROFILE(idx, name) int profileIdx = idx; profileName[profileIdx] = name; totalTime[profileIdx] -= rdtsc() / 1e3;
#define END_PROFILE totalTime[profileIdx] += rdtsc() / 1e3; totalCount[profileIdx]++;
#else
#define BEGIN_PROFILE(idx, name)
#define END_PROFILE
#endif

template<class T> inline void normmod(T &x, T m) { x %= m; if (x < 0) x += m; }
template<class T1, class T2> inline T2 summodfast(T1 x, T1 y, T2 m) { T2 res = x + y; if (res >= m) res -= m; return res; }
template<class T1, class T2, class T3> inline void addmodfast(T1 &x, T2 y, T3 m) { x += y; if (x >= m) x -= m; }
template<class T1, class T2, class T3> inline void submodfast(T1 &x, T2 y, T3 m) { x -= y; if (x < 0) x += m; }
#if INTPTR_MAX == INT32_MAX or !defined(__SIZEOF_INT128__)
inline ll mulmod(ll x, ll n, ll m){ ll r = 0; normmod(x, m); normmod(n, m); while (n) { if (n & 1) r += x; x += x; if (r >= m) r -= m; if (x >= m) x -= m; n /= 2; } return r; }
#else
using int128 = __int128;
inline ll mulmod(ll x, ll n, ll m){ return __int128(x) * n % m; }
#endif
inline ll powmod(ll x, ll n, ll m){ ll r = 1; normmod(x, m); while (n){ if (n & 1) r *= x; x *= x; r %= m; x %= m; n /= 2; }return r; }
inline ll powmulmod(ll x, ll n, ll m) { ll res = 1; normmod(x, m); while (n){ if (n & 1)res = mulmod(res, x, m); x = mulmod(x, x, m); n /= 2; } return res; }
template<class T> inline T gcd(T a, T b) { while (b) { T t = a % b; a = b; b = t; } return a; }
template<class T>
T fast_gcd(T u, T v) {
    int shl = 0; while ( u && v && u != v) { T eu = u & 1; u >>= eu ^ 1; T ev = v & 1; v >>= ev ^ 1;
        shl += (~(eu | ev) & 1); T d = u & v & 1 ? (u + v) >> 1 : 0; T dif = (u - v) >> (sizeof(T) * 8 - 1); u -= d & ~dif; v -= d & dif;
    } return std::max(u, v) << shl;
}

inline ll lcm(ll a, ll b){ return a / gcd(a, b) * b; }
template<class T> inline T gcd(T a, T b, T c){ return gcd(gcd(a, b), c); }
ll gcdex(ll a, ll b, ll& x, ll& y) {
    if (!a) { x = 0; y = 1; return b; }
    ll y1; ll d = gcdex(b % a, a, y, y1); x = y1 - (b / a) * y;
    return d;
}
template<class T> bool isPrime(T x) { if (x <= 4 || x % 2 == 0 || x % 3 == 0) return x == 2 || x == 3;
    for (T i = 5; i * i <= x; i += 6) if (x % i == 0 || x % (i + 2) == 0) return 0; return 1; }
bool millerRabin(long long n) {
    if (n <= 1000) return isPrime(n);
    long long s = n - 1; int t = 0; while (s % 2 == 0) s /= 2, ++t;
    for (int a : {2, 325, 9375, 28178, 450775, 9780504, 1795265022}) { if (!(a %= n)) return true;
        long long f = powmulmod(a, s, n); if (f == 1 || f == n - 1) continue;
        for (int i = 1; i < t; ++i) if ((f = mulmod(f, f, n)) == n - 1) goto nextp;
        return false; nextp:;
    } return true;
}

// Useful constants

//int some_primes[7] = {24443, 100271, 1000003, 1000333, 5000321, 98765431, 1000000123};
#define T9          1000000000
#define T18         1000000000000000000LL
#define INF         1011111111
#define LLINF       1000111000111000111LL
#define mod         1000000007
#define fftmod      998244353
#define EPS         (double)1e-10
#define PI          3.14159265358979323846264
#define link        asaxlajrewqwe
#define rank        wahayawehasdakw
//*************************************************************************************

int32_t solve();
int32_t main(int argc, char** argv) {
    ios_base::sync_with_stdio(0);cin.tie(0);
#ifdef LOCAL
    //        FREIN("input.txt");
    //        FREOUT("out.txt");
#endif
    return solve();
}

ll a[1010101];
ll fact[1010101];
ll rfact[1010101];
ll cnk(int n, int k) {
    if (n < k) return 0;
    return fact[n] * rfact[k] % mod * rfact[n - k] % mod;
}
int solve() {
    rfact[0] = fact[0] = 1;
    for (int i = 1; i <= 1000000; ++i) {
        fact[i] = fact[i - 1] * i % mod;
    }
//    const int N = 1000000;
//    rfact[N] = powmod(fact[N], mod - 2, mod);
//    for (int i = N - 1; i > 0; --i) {
//        rfact[i] = rfact[i + 1] * (i + 1) % mod;
//    }
    int n;
    cin >> n;
    FI(n) {
        cin >> a[i];
    }
    sort(a, a + n);
//    reverse(a, a + n);
    int b = 0;
    int cur = 1;
    ll ans = 0;
//    FI(n) {
//        ans = (ans + fact[n] * a[i]) % mod;
//    }
//    DBN(ans);
    int m = (int)a[n - 1];
    for (int i = 0; i < n; ++i) {
        if (a[i] == m) break;
        if (i) {
            if (a[i] != a[i - 1]) {
                b += cur;
                cur = 0;
            }
        }
        int less = n - 1 - b;
//        DBN(i, a[i], less);
        ll t = fact[n] * powmod(less + 1, mod - 2, mod);
        t %= mod;
        if (t < 0) t += mod;
        ans = (ans + t * a[i]) % mod;
        if (ans < 0) ans += mod;
        ++cur;
    }
    cout << ans << endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
#define pb push_back
#define pp pop_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define sz(s) s.size()
#define fi first
#define se second
#define cl clear

const int maxn = 3 * 1000 * 1000 + 10;
const ll mod = 1000 * 1000 * 1000 + 7;
const ll inf = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 10;

ll pw(ll a, ll b){
    return (b == 0 ? 1LL : ((pw(a * a % mod, b / 2) * (b & 1 == 1 ? a : 1LL)) % mod));
}
ll comb(ll n, ll k){
    ll _max = max(k, n - k), _min = min(k, n - k), f = 1, s = 1;
    for(int i = 0; i < n - _max; i++){f *= n - i; f %= mod;}
    for(int i = 1; i <= _min; i++){s *= i; s %= mod;}
    return ((f * pw(s, mod - 2)) % mod);
}
ll ar[maxn], fact[maxn];
vector <pair<ll, ll> > arr;

int main ()
{
    //cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

    ll n, ans = 0;
    cin >> n;
    for(int i = 0; i < n; i++) cin >> ar[i];
    sort(ar, ar + n);
    for(int i = 0; i < n; i++){
        if(!arr.empty() and ar[i] == arr.back().fi){
            ll a = arr.back().se + 1;
            arr.pp();
            arr.pb(mp(ar[i], a));
        }
        else arr.pb(mp(ar[i], 1));
    }
    ll m = arr.size();
    fact[0] = 1;
    ll cnt = 0;
    for(int i = 1; i <  maxn; i++) fact[i] = (fact[i - 1] * i) % mod;
    for(int i = 0; i < m - 1; i++){
        ll a = (fact[n] * pw(fact[n - cnt] * fact[cnt] % mod, mod - 2)) % mod;
        a *= fact[n - cnt - 1];
        a %= mod;
        a *= fact[cnt];
        a %= mod;
        a *= arr[i].fi * arr[i].se % mod;
        a %= mod;
        ans += a;
        ans %= mod;
        cnt += arr[i].se;
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int N = 1e6 + 1;
const ll mod = 1e9 + 7;
int n;
ll Pow(ll x, ll a){
    ll res = 1;
    while(a){
        if(a & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        a >>= 1;
    }
    return res;
}
ll a[N];
ll fac[N];
ll inv[N];
ll C(int n, int k){
    return ((fac[n] * inv[k]) % mod * inv[n - k]) % mod;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    fac[0] = inv[0] = 1;
    for(int i = 1; i < N; i++){
        fac[i] = (fac[i - 1] * i) % mod;
        inv[i] = Pow(fac[i], mod - 2);
    }
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    sort(a + 1, a + n + 1);
    ll cnt = 1;
    ll res = 0;
    for(int i = 1; i < n; i++){
        if(a[i] != a[i + 1]){
            ll temp = (fac[n - i + cnt - 1] * cnt) % mod;
            temp = (temp * C(n, n - i + cnt)) % mod;
            temp = (temp * fac[i - cnt]) % mod;
            res = (res + temp * a[i]) % mod;
            cnt = 1;
        }
        else cnt++;
    }
    cout << res;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int MOD = 1'000'000'007;

long long power(long long base, int e, int M=MOD)
{
    long long result = 1;
    base %= M;
    while (e) {
        if (e & 1)
            result = (result * base) % M;
        base = (base * base) % M;
        e >>= 1;
    }
    return result;
}

auto inverse(long long x) {
    return power(x, MOD - 2);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    long long f = 1;
    for (int i = 1; i <= n; i++) {
        f = (f * i) % MOD;
    }

    long long result = 0;
    vector<long long> p(n);
    for (int i = 0; i < n; i++) {
        if (i == 0 || a[i] > a[i-1])
            p[i] = n - i - 1;
        else
            p[i] = p[i-1];

        if (a[i] != a.back())
            result += f * inverse(p[i] + 1) % MOD * a[i] % MOD;
    }

    cout << (result % MOD) << endl;

}


#include <bits/stdc++.h>
using namespace std;

int MOD = 1'000'000'007;

long long power(long long base, int e, int M=MOD)
{
    long long result = 1;
    base %= M;
    while (e) {
        if (e & 1)
            result = (result * base) % M;
        base = (base * base) % M;
        e >>= 1;
    }
    return result;
}

auto inverse(long long x) {
    return power(x, MOD - 2);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    long long f = 1;
    for (int i = 1; i <= n; i++) {
        f = (f * i) % MOD;
    }

    long long result = 0;
    vector<long long> p(n);
    for (int i = 0; i < n; i++) {
        if (i == 0 || a[i] > a[i-1])
            p[i] = n - i - 1;
        else
            p[i] = p[i-1];

        if (p[i])
            result += f * inverse(p[i] + 1) % MOD * a[i] % MOD;
    }

    cout << (result % MOD) << endl;

}


#include <bits/stdc++.h>
using namespace std;

int MOD = 1'000'000'007;

long long power(long long base, int e, int M=MOD)
{
    long long result = 1;
    base %= M;
    while (e) {
        if (e & 1)
            result = (result * base) % M;
        base = (base * base) % M;
        e >>= 1;
    }
    return result;
}

auto inverse(long long x) {
    return power(x, MOD - 2);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    long long f = 1;
    for (int i = 1; i <= n; i++) {
        f = (f * i) % MOD;
    }

    long long result = 0;
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        if (i == 0 || a[i] > a[i-1])
            p[i] = n - i - 1;
        else
            p[i] = p[i-1];

        if (p[i])
            result += f * inverse(p[i] + 1) % MOD * a[i] % MOD;
    }

    cout << (result % MOD) << endl;

}


#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define ll long long
#define maxn 200005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define S second
#define F first
const int mod = 1e9 + 7;
ll Inv[1000005];
void inv(int n){
    Inv[1] = 1;
    for(int i = 2 ; i <= n ; i++){
        Inv[i] = (mod - mod / i * Inv[mod % i] % mod) % mod;
    }
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    ll tot = 1;
    f1(n){
        tot *= i;
        tot %= mod;
    }
    vector<int>v;
    f(n){
        int add;
        cin >> add;
        v.pb(add);
    }
    inv(n);
    sort(v.rbegin(),v.rend());
    ll cur = 0;
    ll ans = 0;
    int last = 0;
    int cnt = 0;
    for(int i = 0 ; i < n ; i++){
        if(v[i] == last){
            cur++;
            cnt++;
            continue;
        }
        if(last != v[0]){
            ans += tot * last % mod * Inv[cur] % mod * cnt % mod;
            ans %= mod;
        }
        cur++;
        cnt = 1;
        last = v[i];
    }
    if(last != v[0]){
        ans += tot * last % mod * Inv[cur] % mod * cnt % mod;
        ans %= mod;
    }
    cout << ans << '\n';
}


#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define ll long long
#define maxn 200005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define S second
#define F first
const int mod = 1e9 + 7;
ll inv(int x){
    int p = mod - 2;
    ll ret = 1;
    ll now = x;
    while(p){
        if(p&1){
            ret *= now;
            ret %= mod;
        }
        now *= now;
        now %= mod;
        p >>= 1;
    }
    return ret;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    ll tot = 1;
    f1(n){
        tot *= i;
        tot %= mod;
    }
    vector<int>v;
    f(n){
        int add;
        cin >> add;
        v.pb(add);
    }
    sort(v.rbegin(),v.rend());
    ll cur = 0;
    ll ans = 0;
    int last = 0;
    int cnt = 0;
    for(int i = 0 ; i < n ; i++){
        if(v[i] == last){
            cur++;
            cnt++;
            continue;
        }
        if(last != v[0]){
            ans += tot * last % mod * inv(cur) % mod * cnt % mod;
            ans %= mod;
        }
        cur++;
        cnt = 1;
        last = v[i];
    }
    if(last != v[0]){
        ans += tot * last % mod * inv(cur) % mod * cnt % mod;
        ans %= mod;
    }
    cout << ans << '\n';
}


#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define ll long long
#define maxn 200005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define S second
#define F first
const int mod = 1e9 + 7;
ll inv(int x){
    int p = mod - 2;
    ll ret = 1;
    ll now = x;
    while(p){
        if(p&1){
            ret *= now;
            ret %= mod;
        }
        now *= now;
        now %= mod;
        p >>= 1;
    }
    return ret;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    ll tot = 1;
    f1(n){
        tot *= i;
        tot %= mod;
    }
    vector<int>v;
    f(n){
        int add;
        cin >> add;
        v.pb(add);
    }
    sort(v.rbegin(),v.rend());
    ll cur = 0;
    ll ans = 0;
    int last = 0;
    int cnt = 0;
    for(int i = 0 ; i < n ; i++){
        if(v[i] == last){
            cur++;
            cnt++;
            continue;
        }
        if(last != v[0]){
            ans += tot * last % mod * inv(cur) % mod * cnt % mod;
            ans %= mod;
        }
        cur++;
        cnt = 1;
        last = v[i];
    }
    ans += tot * last % mod * inv(cur) % mod * cnt % mod;
    ans %= mod;
    cout << ans << '\n';
}


#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

vector<pair<ll, ll>> RLE(vector<ll> & s) {
	ll cnt = 0;
	vector<pair<ll, ll>> res;
	for (ll i = 0; i < s.size(); i++) {
		cnt++;
		if (i == (ll)s.size() - 1) {
			res.push_back(make_pair(s[i], cnt));
			break;
		}
		if (s[i] != s[i + 1]) {
			res.push_back(make_pair(s[i], cnt));
			cnt = 0;
		}
	}
	return res;
}
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	ll n; scanf("%lld", &n);
	vector<ll> a(n); for (ll i = 0; i < n; i++) scanf("%lld", &a[i]);
	sort(a.begin(), a.end());
	auto vp = RLE(a);
	mint res = 0;
	ll sum = n;
	vector<mint> fac(n + 1);
	fac[0] = 1;
	fac[1] = 1;
	for (int i = 2; i <= n; i++) fac[i] = fac[i - 1] * i;
	for (int i = 0; i + 1 < vp.size(); i++) {
		//cout << sum + 1 << " " << fac[n].x << " " << vp[i].second << "\n";
		res += mint(vp[i].first) / mint(sum) * fac[n] * vp[i].second;
		sum -= vp[i].second;
	}
	cout << res.x << "\n";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
#define pii pair<ll,ll>
#define vi vector<ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define pf(n) printf("%lld\n",n)
#define sf(n) scanf("%lld",&n)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) x.begin(),x.end()
#define ms(n,i) memset(n,i,sizeof n)
#define sz(x) (ll)x.size()
#define pi 3.141592653589793238
#define hell 1000000007
#define endl '\n'
#define inf 1e18
#define N 200005

ll fpow(ll b,ll e)
{
    ll res=1;
    while(e>0){
        if(e&1)res=res*b%hell;
        b=b*b%hell;
        e>>=1;
    }
    return res;
}
ll inv(ll f)
{
    return fpow(f,hell-2)%hell;
}
int main()
{
    ll n,i,j,k,x,y,ans=0;
    cin>>n;
    ll a[n];
    map<ll,ll> mapp;
    for(i=0;i<n;i++)
        cin>>a[i],mapp[a[i]]++;
    ll chote_nums=0,fact=1;
    for(i=1;i<=n;i++)
        fact=fact*i%hell;
    ll s=sz(mapp);
    for(auto i:mapp){
        s--;
        if(s==0)break;
        ans=(ans+((((i.fi*i.se)%hell)*((fact*inv(n-chote_nums)%hell)))%hell)%hell)%hell;
        chote_nums+=i.se;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
#define pii pair<ll,ll>
#define vi vector<ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define pf(n) printf("%lld\n",n)
#define sf(n) scanf("%lld",&n)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) x.begin(),x.end()
#define ms(n,i) memset(n,i,sizeof n)
#define sz(x) (ll)x.size()
#define pi 3.141592653589793238
#define hell 1000000007
#define endl '\n'
#define inf 1e18
#define N 200005

ll fpow(ll b,ll e)
{
    ll res=1;
    while(e>0){
        if(e&1)res=res*b%hell;
        b=b*b%hell;
        e>>=1;
    }
    return res;
}
ll inv(ll f)
{
    return fpow(f,hell-2)%hell;
}
int main()
{
    ll n,i,j,k,x,y,ans=0;
    cin>>n;
    ll a[n];
    map<ll,ll> mapp;
    for(i=0;i<n;i++)
        cin>>a[i],mapp[a[i]]++;
    ll chote_nums=0,fact=1;
    for(i=1;i<=n;i++)
        fact=fact*i%hell;
    ll s=sz(mapp);
    for(auto i:mapp){
        s--;
        if(s==0)break;
        ans=(ans+(i.fi*i.se)%hell*(fact*inv(n-chote_nums))%hell)%hell;
        chote_nums+=i.se;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
#define pii pair<ll,ll>
#define vi vector<ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define pf(n) printf("%lld\n",n)
#define sf(n) scanf("%lld",&n)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) x.begin(),x.end()
#define ms(n,i) memset(n,i,sizeof n)
#define sz(x) (ll)x.size()
#define pi 3.141592653589793238
#define hell 1000000007
#define endl '\n'
#define inf 1e18
#define N 200005

ll fpow(ll b,ll e)
{
    ll res=1;
    while(e>0){
        if(e&1)res=res*b%hell;
        b=b*b%hell;
        e>>=1;
    }
    return res;
}
ll inv(ll f)
{
    return fpow(f,hell-2)%hell;
}
int main()
{
    ll n,i,j,k,x,y,ans=0;
    cin>>n;
    ll a[n];
    map<ll,ll> mapp;
    for(i=0;i<n;i++)
        cin>>a[i],mapp[a[i]]++;
    ll chote_nums=0,fact=1;
    for(i=1;i<=n;i++)
        fact=fact*i%hell;
    ll s=sz(mapp);
    for(auto i:mapp){
        s--;
        if(s==0)break;
        ans=(ans+((i.fi*i.se)%hell*(fact*inv(n-chote_nums))%hell)%hell)%hell;
        chote_nums+=i.se;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
#define pii pair<ll,ll>
#define vi vector<ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define pf(n) printf("%lld\n",n)
#define sf(n) scanf("%lld",&n)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) x.begin(),x.end()
#define ms(n,i) memset(n,i,sizeof n)
#define sz(x) (ll)x.size()
#define pi 3.141592653589793238
#define hell 1000000007
#define endl '\n'
#define inf 1e18
#define N 200005

ll fpow(ll b,ll e)
{
    ll res=1;
    while(e>0){
        if(e&1)res=res*b%hell;
        b=b*b%hell;
        e>>=1;
    }
    return res;
}
ll inv(ll f)
{
    return fpow(f,hell-2)%hell;
}
int main()
{
    fast
    ll n,i,j,k,x,y,ans=0;
    cin>>n;
    ll a[n];
    map<ll,ll> mapp;
    for(i=0;i<n;i++)
        cin>>a[i],mapp[a[i]]++;
    ll chote_nums=0,fact=1;
    for(i=1;i<=n;i++)
        fact=fact*i%hell;
    ll s=sz(mapp);
    for(auto i:mapp){
        s--;
        if(s==0)break;
        ans=(ans+((((i.fi*i.se)%hell)*((fact*inv(n-chote_nums)%hell)))%hell)%hell)%hell;
        chote_nums+=i.se;
    }
    cout<<ans<<endl;
}


#include <bits/stdc++.h>
#define int long long
#define ld long double
#define y1 sdopgh

using namespace std;
const int MOD=1e9+7;

int n, a[1000005], fact[1000005];

int add(int x, int y)
{
    return (x+y)%MOD;
}

int mul(int x, int y)
{
    return x*y%MOD;
}

int binpow(int x, int y)
{
    if(y==0)
        return 1;
    if(y%2)
        return mul(x, binpow(x, y-1));
    int z=binpow(x, y/2);
    return mul(z, z);
}

int inv(int x)
{
    return binpow(x, MOD-2);
}

int divide(int x, int y)
{
    return mul(x, inv(y));
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    fact[0]=1;
    for(int i=1; i<1000005; i++)
        fact[i] = mul(fact[i-1], i);

    cin >> n;
    for(int i=0; i<n; i++)
        cin >> a[i];
    sort(a, a+n);

    int Max = a[n-1];
    int ans = 0;

    int b=n;
    for(int i=0;i<n;i++)
        if(a[i]!=Max)
    {
        if(i!=0 && a[i]!=a[i-1])
            b=n-i;
        ans = add(ans, mul(a[i], divide(fact[n], b)));
    }
    cout << ans;
}


#include <bits/stdc++.h>
#define int long long
#define ld long double
#define y1 sdopgh

using namespace std;
const int MOD=1e9+7;

int n, a[1000005], fact[1000005];

int add(int x, int y)
{
    return (x+y)%MOD;
}

int mul(int x, int y)
{
    return x*y%MOD;
}

int binpow(int x, int y)
{
    if(y==0)
        return 1;
    if(y%2)
        return mul(x, binpow(x, y-1));
    int z=binpow(x, y/2);
    return mul(z, z);
}

int inv(int x)
{
    return binpow(x, MOD-2);
}

int divide(int x, int y)
{
    return mul(x, inv(y));
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    fact[0]=1;
    for(int i=1; i<1000005; i++)
        fact[i] = mul(fact[i-1], i);

    cin >> n;
    for(int i=0; i<n; i++)
        cin >> a[i];
    sort(a, a+n);

    int Max = a[n-1];
    int ans = 0;

    int b=n;
    for(int i=0;i<n;i++)
        if(a[i]!=Max)
    {
        if(i!=0 && a[i]!=a[i-1])
            b=n-i;
        ans = add(ans, divide(fact[n], b));
    }
    cout << ans;
}


// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

int inv[1000006];
int nf = 1;
int n;

int ar[1000006];
signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    inv[0] = inv[1] = 1;
	gi(n);
	iter(i, 2, n+2) inv[i]=1ll*(MOD-MOD/i)*inv[MOD%i]%MOD;
	rep1(i, n) nf = 1ll * nf * i % MOD;
	rep(i, n) gi(ar[i]);
	sort(ar, ar+n);
	int t = ar[n-1], N = n;
	while(n && ar[n-1] == t) n--;
	int cnt = 0, ans = 0;
	rep(i, n) {
		while(ar[cnt] < ar[i]) cnt++;
		ans = (ans + 1ll * ar[i] * nf % MOD * inv[N-cnt]) %MOD;
	}
	print(ans);
}


// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

int inv[1000006];
int nf = 1;
int n;

int ar[1000006];
signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    inv[0] = inv[1] = 1;
	gi(n);
	iter(i, 2, n+2) inv[i]=1ll*(MOD-MOD/i)*inv[MOD%i]%MOD;
	rep1(i, n) nf = 1ll * nf * i % MOD;
	rep(i, n) gi(ar[i]);
	sort(ar, ar+n);
	int t = ar[n-1], N = n;
	while(n && ar[n-1] == t) n--;
	int cnt = 0, ans = 0;
	rep(i, n) {
		while(ar[cnt] < ar[i]) cnt++;
		ans = (ans + 1ll * nf * inv[N-cnt]) %MOD;
	}
	print(ans);
}


// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

int inv[1000006];
int nf = 1;
int n;

int ar[1000006];
signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    inv[0] = inv[1] = 1;
	gi(n);
	iter(i, 2, n+2) inv[i]=1ll*(MOD-MOD/i)*inv[MOD%i]%MOD;
	rep1(i, n) nf = 1ll * nf * i % MOD;
	rep(i, n) gi(ar[i]);
	sort(ar, ar+n);
	int cnt = 0, ans = 0;
	rep(i, n-1) {
		while(ar[cnt] < ar[i]) cnt++;
		ans = (ans + 1ll * nf * inv[n-cnt]) %MOD;
	}
	print(ans);
}


// region boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <chrono>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cplusplus >= 201703L
#   define all(a)      begin(a),end(a)
#   define sz(x)       ((int)size(x))
#else
#   define all(a)      (a).begin(),(a).end()
#   define sz(x)       ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __cplusplus >= 201703L
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9 + 5;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18 + 5;
MAYBE_UNUSED static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
//endregion

namespace snippets_modular {
    template <class C>
    struct Modular {
        using I = decltype(C::m());
        I val = 0;

    private:
#ifdef __SIZEOF_INT128__
        using Mul = conditional_t<sizeof(I) >= 5, unsigned __int128, uint64_t>;
#else
        static_assert(sizeof(I) <= 4, "cannot multiply larger than 64-bit");
        using Mul = uint64_t;
#endif

        struct Unchecked {};
        constexpr Modular(I _val, Unchecked) : val(_val) {}
        static constexpr array<I, 3> ext_gcd(I a, I b) {
            if (!a) return {b,0,1};
            auto ar = ext_gcd(b % a, a);
            return {ar[0], ar[2] - (b / a) * ar[1], ar[1]};
        }
    public:

        constexpr Modular() = default;
        template <class T>
        constexpr Modular(T _val) { _val %= C::m(); if (_val < 0) _val += C::m(); val = static_cast<I>(_val); }

        template <class T>
        constexpr explicit operator T() const { return static_cast<T>(val); }

#define DEFINE_CMP(op) constexpr bool operator op (Modular r) const { return val op r.val; }
        DEFINE_CMP(==) DEFINE_CMP(!=) DEFINE_CMP(<) DEFINE_CMP(<=) DEFINE_CMP(>) DEFINE_CMP(>=)
#undef DEFINE_CMP

        constexpr Modular& operator+=(Modular r) { if ((val += r.val) >= C::m()) val -= C::m(); return *this; }
        constexpr Modular& operator-=(Modular r) { if (r.val > val) val += C::m(); val -= r.val; return *this; }
        template <class T> constexpr enable_if_t<is_integral<T>::value, Modular&> operator+=(T r) { return *this += Modular(r); }
        template <class T> constexpr enable_if_t<is_integral<T>::value, Modular&> operator-=(T r) { return *this -= Modular(r); }
        constexpr Modular operator+(Modular r) const { return Modular(*this) += r; }
        constexpr Modular operator-(Modular r) const { return Modular(*this) -= r; }

        constexpr Modular operator*(Modular r) const { return Modular(static_cast<Mul>(val) * static_cast<Mul>(r.val)); }
        constexpr Modular& operator*=(Modular r) { return *this = *this * r; }
        template <class T> constexpr enable_if_t<is_integral<T>::value, Modular&> operator*=(T r) { return *this *= Modular(r); }

        template <class T> constexpr Modular pow(T e) const {
            Modular a = 1, b = *this;
            for (; e > 0; b *= b, e /= 2)
                if (e % 2) a *= b;
            return a;
        }
        constexpr Modular inv() const { I x = ext_gcd(val, C::m())[1]; return Modular(x < 0 ? x + C::m() : x, Unchecked{}); }

        constexpr Modular& operator/=(Modular r) { return *this *= r.inv(); }
        template <class T> constexpr enable_if_t<is_integral<T>::value, Modular&> operator/=(T r) { return *this /= Modular(r); }
        constexpr Modular operator/(Modular r) const { return Modular(*this) /= r; }

        constexpr Modular operator+() const { return *this; }
        constexpr Modular operator-() const { return Modular(val ? -val + C::m() : val, Unchecked{}); }
        constexpr Modular& operator++() { return *this += 1; }
        constexpr Modular& operator--() { return *this -= 1; }
        constexpr Modular operator++(int) { auto r = *this; *this += 1; return r; }
        constexpr Modular operator--(int) { auto r = *this; *this -= 1; return r; }
    };

#define DEFINE_OPS(op) \
        template <class C, class T, class = enable_if_t<is_integral<T>::value>> \
        constexpr auto operator op (Modular<C> l, T r) { return Modular<C>(l) op Modular<C>(r); } \
        template <class C, class T, class = enable_if_t<is_integral<T>::value>> \
        constexpr auto operator op (T l, Modular<C> r) { return Modular<C>(l) op Modular<C>(r); }
    DEFINE_OPS(==) DEFINE_OPS(!=) DEFINE_OPS(<) DEFINE_OPS(<=) DEFINE_OPS(>) DEFINE_OPS(>=)
    DEFINE_OPS(+) DEFINE_OPS(-) DEFINE_OPS(*) DEFINE_OPS(/)
#undef DEFINE_OPS

    template<class C> std::ostream& operator<<(std::ostream& out, Modular<C> m) { return out << m.val; }
    template <class C> std::istream& operator>>(std::istream& in, Modular<C>& m) {
        // Avoid reading character types
        using I = typename Modular<C>::I;
        using T = conditional_t<is_same<I, signed char>::value || is_same<I, unsigned char>::value || is_same<I, char>::value, int, I>;

        T val{};
        in >> val;
        m = Modular<C>(val);
        return in;
    }
    template<class C> string to_string(Modular<C> m) { return ::to_string(m.val); }

    template <class I, I M> struct ConstMod { static constexpr I m() { return M; } };
    using MI = Modular<ConstMod<int, (int)1e9 + 7>>;
    using vMI = vector<MI>;
}
using namespace snippets_modular;
namespace std {
    template <class C> struct hash<Modular<C>> {
        size_t operator()(Modular<C> m) const { return hash<typename Modular<C>::I>()(m.val); }
    };
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, ai; cin >> n;
    map<int, int> m;
    rep(_, n)
        cin >> ai, m[ai]++;

    MI nfac = 1;
    reps(i, 1, n + 1)
        nfac *= i;

    m.erase(prev(end(m)));
    MI sum = 0;
    int x = 0;
    for (auto [ai, c] : m)
        sum += c * nfac / (n - x) * ai, x += c;
    cout << sum << '\n';

    return 0;
}


// region boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <chrono>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cplusplus >= 201703L
#   define all(a)      begin(a),end(a)
#   define sz(x)       ((int)size(x))
#else
#   define all(a)      (a).begin(),(a).end()
#   define sz(x)       ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __cplusplus >= 201703L
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9 + 5;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18 + 5;
MAYBE_UNUSED static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
//endregion

namespace snippets_modular {
    template <class C>
    struct Modular {
        using I = decltype(C::m());
        I val = 0;

    private:
#ifdef __SIZEOF_INT128__
        using Mul = conditional_t<sizeof(I) >= 5, unsigned __int128, uint64_t>;
#else
        static_assert(sizeof(I) <= 4, "cannot multiply larger than 64-bit");
        using Mul = uint64_t;
#endif

        struct Unchecked {};
        constexpr Modular(I _val, Unchecked) : val(_val) {}
        static constexpr array<I, 3> ext_gcd(I a, I b) {
            if (!a) return {b,0,1};
            auto ar = ext_gcd(b % a, a);
            return {ar[0], ar[2] - (b / a) * ar[1], ar[1]};
        }
    public:

        constexpr Modular() = default;
        template <class T>
        constexpr Modular(T _val) { _val %= C::m(); if (_val < 0) _val += C::m(); val = static_cast<I>(_val); }

        template <class T>
        constexpr explicit operator T() const { return static_cast<T>(val); }

#define DEFINE_CMP(op) constexpr bool operator op (Modular r) const { return val op r.val; }
        DEFINE_CMP(==) DEFINE_CMP(!=) DEFINE_CMP(<) DEFINE_CMP(<=) DEFINE_CMP(>) DEFINE_CMP(>=)
#undef DEFINE_CMP

        constexpr Modular& operator+=(Modular r) { if ((val += r.val) >= C::m()) val -= C::m(); return *this; }
        constexpr Modular& operator-=(Modular r) { if (r.val > val) val += C::m(); val -= r.val; return *this; }
        template <class T> constexpr enable_if_t<is_integral<T>::value, Modular&> operator+=(T r) { return *this += Modular(r); }
        template <class T> constexpr enable_if_t<is_integral<T>::value, Modular&> operator-=(T r) { return *this -= Modular(r); }
        constexpr Modular operator+(Modular r) const { return Modular(*this) += r; }
        constexpr Modular operator-(Modular r) const { return Modular(*this) -= r; }

        constexpr Modular operator*(Modular r) const { return Modular(static_cast<Mul>(val) * static_cast<Mul>(r.val)); }
        constexpr Modular& operator*=(Modular r) { return *this = *this * r; }
        template <class T> constexpr enable_if_t<is_integral<T>::value, Modular&> operator*=(T r) { return *this *= Modular(r); }

        template <class T> constexpr Modular pow(T e) const {
            Modular a = 1, b = *this;
            for (; e > 0; b *= b, e /= 2)
                if (e % 2) a *= b;
            return a;
        }
        constexpr Modular inv() const { I x = ext_gcd(val, C::m())[1]; return Modular(x < 0 ? x + C::m() : x, Unchecked{}); }

        constexpr Modular& operator/=(Modular r) { return *this *= r.inv(); }
        template <class T> constexpr enable_if_t<is_integral<T>::value, Modular&> operator/=(T r) { return *this /= Modular(r); }
        constexpr Modular operator/(Modular r) const { return Modular(*this) /= r; }

        constexpr Modular operator+() const { return *this; }
        constexpr Modular operator-() const { return Modular(val ? -val + C::m() : val, Unchecked{}); }
        constexpr Modular& operator++() { return *this += 1; }
        constexpr Modular& operator--() { return *this -= 1; }
        constexpr Modular operator++(int) { auto r = *this; *this += 1; return r; }
        constexpr Modular operator--(int) { auto r = *this; *this -= 1; return r; }
    };

#define DEFINE_OPS(op) \
        template <class C, class T, class = enable_if_t<is_integral<T>::value>> \
        constexpr auto operator op (Modular<C> l, T r) { return Modular<C>(l) op Modular<C>(r); } \
        template <class C, class T, class = enable_if_t<is_integral<T>::value>> \
        constexpr auto operator op (T l, Modular<C> r) { return Modular<C>(l) op Modular<C>(r); }
    DEFINE_OPS(==) DEFINE_OPS(!=) DEFINE_OPS(<) DEFINE_OPS(<=) DEFINE_OPS(>) DEFINE_OPS(>=)
    DEFINE_OPS(+) DEFINE_OPS(-) DEFINE_OPS(*) DEFINE_OPS(/)
#undef DEFINE_OPS

    template<class C> std::ostream& operator<<(std::ostream& out, Modular<C> m) { return out << m.val; }
    template <class C> std::istream& operator>>(std::istream& in, Modular<C>& m) {
        // Avoid reading character types
        using I = typename Modular<C>::I;
        using T = conditional_t<is_same<I, signed char>::value || is_same<I, unsigned char>::value || is_same<I, char>::value, int, I>;

        T val{};
        in >> val;
        m = Modular<C>(val);
        return in;
    }
    template<class C> string to_string(Modular<C> m) { return ::to_string(m.val); }

    template <class I, I M> struct ConstMod { static constexpr I m() { return M; } };
    using MI = Modular<ConstMod<int, (int)1e9 + 7>>;
    using vMI = vector<MI>;
}
using namespace snippets_modular;
namespace std {
    template <class C> struct hash<Modular<C>> {
        size_t operator()(Modular<C> m) const { return hash<typename Modular<C>::I>()(m.val); }
    };
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, ai; cin >> n;
    map<int, int> m;
    rep(_, n)
        cin >> ai, m[ai]++;

    MI nfac = 1;
    reps(i, 1, n + 1)
        nfac *= i;

    m.erase(prev(end(m)));
    MI sum = 0;
    int x = 0;
    for (auto [ai, c] : m)
        sum += c * nfac / (n - x) * ai;
    cout << sum << '\n';

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long

int modInverse(int a, int m)
{
    int m0 = m;
    int y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {
        // q is quotient
        int q = a / m;
        int t = m;

        // m is remainder now, process same as
        // Euclid's algo
        m = a % m, a = t;
        t = y;

        // Update y and x
        y = x - q * y;
        x = t;
    }

    // Make x positive
    if (x < 0)
       x += m0;

    return x;
}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    map<int,int> mp;
    int ma=0;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        ma=max(ma,x);
        mp[x]++;
    }
    int fct[n+10];
    fct[0]=1;
    int mo=1000000007;
    for(int i=1;i<=n;i++)
        fct[i]=(fct[i-1]*i)%mo;

    int f=0;
    int ans=0;
    for(auto it=mp.rbegin();it!=mp.rend();it++)
    {
        f+=it->second;

        if(it->first == ma)
            continue;
        int k=(it->first * fct[n])%mo;
        k=(k * modInverse(f,mo))%mo;
        k=(k * it->second)%mo;
        ans=(ans + k)%mo;
    }
    cout<<ans;
}


/// IN THE NAME OF METAL
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define sz(x)                       (ll) x.size()
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second

ll Pow(ll a, ll b, ll md, ll ans = 1) {
    for (; b; b >>= 1, a = a * a % md)
        if (b & 1)
            ans = ans * a % md;
    return ans % md;
}

const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
ll A[MAXN], cnt[MAXN], fact[MAXN], inv[MAXN], n, l = 0, ans = 0, mx = 0;

int main() {
    fact[0] = 1;
    for (ll i = 1; i < MAXN; i++) fact[i] = fact[i - 1] * i % MOD;
    for (ll i = 0; i < MAXN; i++) inv[i] = Pow(i, MOD - 2, MOD);
    scanf("%lld", &n);
    for (ll i = 1; i <= n; i++) scanf("%lld", &A[i]), mx = max(mx, A[i]);
    sort(A + 1, A + n + 1);
    cnt[1] = 0;
    for (ll i = 2; i <= n; i++) {
        if (A[i] == A[i - 1]) cnt[i] = cnt[i - 1], l++;
        else cnt[i] = cnt[i - 1] + l + 1, l = 0;
    }
    //for (ll i = 1; i <= n; i++) printf("%lld ", cnt[i]);
    //printf("\n");
    for (ll i = 1; i <= n; i++) {
        if (A[i] == mx) break;
        ans = (ans + A[i] * fact[n] % MOD * inv[n - cnt[i]] % MOD) % MOD;
    }
    printf("%lld\n", ans);
    return 0;
}


#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV) || defined(OCL)
#define DEV 1
#else
#define DEV 0
#endif
#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV)
#define DEV 1
#else
#define DEV 0
#pragma GCC optimize("O3")
#endif
#if defined(__GNUC__) || defined(OCL)
#include <bits/stdc++.h>
#else

#if DEV
#include "../allstd.h"
#else
#ifndef OCL
#include "no-such-header.h"
#endif
#endif
#endif
//opl includes go here
using namespace std;

template<typename... Vectors>
void resizeVectors(int newSize, Vectors& ...vectors) {
    (vectors.resize(newSize), ...);
}

template<typename... Vectors>
void readEntryHelper(int i, Vectors& ...vectors) {
    ((cin >> vectors[i]), ...);
}

template<typename... Vectors>
void readVectors(int count, Vectors& ...vectors) {
    (resizeVectors(count, (vectors, ...)));
    for (int i = 0; i < count; ++i) {
        (readEntryHelper(i, (vectors, ...)));
    }
}

using ll = signed long long;
using ld = long double;
void $main();
int main() {
    int numTests = 1;
    if (DEV) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        cin >> numTests;
    } else {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
    }
    for (int i = 0; i < numTests; ++i) {
        $main();
        if (DEV) {
            cout << "-----\n";
        }
    }
}
using ___int = int;
#define int ll
const ll MOD = 1'000'000'007;
ll mfact(ll x, ll y) {
    ll ans = 1;
    for (ll i = 2; i <= x; ++i) {
        if (i == y) continue;
        ans *= i;
        ans %= MOD;
    }
    return ans;
}

ll mmul(ll x, ll y) {
    assert(0 <= x);
    assert(0 <= y);
    assert(x < MOD);
    assert(y < MOD);
    return (x * y) % MOD;
}
ll mmod_pow(ll x, ll p) {
    assert(x < MOD);
    assert(x > 0);
    ll ans = 1;
    while (p) {
        if (p % 2 == 1) {
            ans = mmul(ans, x);
        }
        x = mmul(x, x);
        p /= 2;
    }
    assert(ans < MOD);
    return ans;
}

ll minverse(ll x) {
    return mmod_pow(x, MOD - 2);
}

ll mdiv(ll x, ll y) {
    return mmul(x, minverse(y));
}

ll msub(ll x, ll y) {
    return (x - y + 2 * MOD) % MOD;
}

ll madd(ll x, ll y) {
    return (x + y) % MOD;
}
void $main() {
    ll n;
    cin >> n;
    vector<ll> a;
    readVectors((___int)n, a);
    map<ll, ll> m;
    for (auto x : a) ++m[x];
    ll ans = 0;
    ll mul = 1;
    ll maxVal = *max_element(a.begin(), a.end());
    ll k = 0;
    ll f = mfact(n, n + 1);
    for (auto it : m) {
        auto[num, count] = it;
        if (num == maxVal) continue;
        //mul = 0;
        ll dans = mdiv(
            mmul(num, f),
            msub(n, k)
        );
        dans = mmul(dans, count);
        ans = madd(ans, dans);
        k += count;
    }
    cout << ans << "\n";
    //sort(a.begin(), a.end());
}


#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV) || defined(OCL)
#define DEV 1
#else
#define DEV 0
#endif
#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV)
#define DEV 1
#else
#define DEV 0
#pragma GCC optimize("O3")
#endif
#if defined(__GNUC__) || defined(OCL)
#include <bits/stdc++.h>
#else

#if DEV
#include "../allstd.h"
#else
#ifndef OCL
#include "no-such-header.h"
#endif
#endif
#endif
//opl includes go here
using namespace std;

template<typename... Vectors>
void resizeVectors(int newSize, Vectors& ...vectors) {
    (vectors.resize(newSize), ...);
}

template<typename... Vectors>
void readEntryHelper(int i, Vectors& ...vectors) {
    ((cin >> vectors[i]), ...);
}

template<typename... Vectors>
void readVectors(int count, Vectors& ...vectors) {
    (resizeVectors(count, (vectors, ...)));
    for (int i = 0; i < count; ++i) {
        (readEntryHelper(i, (vectors, ...)));
    }
}

using ll = signed long long;
using ld = long double;
void $main();
int main() {
    int numTests = 1;
    if (DEV) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        cin >> numTests;
    } else {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
    }
    for (int i = 0; i < numTests; ++i) {
        $main();
        if (DEV) {
            cout << "-----\n";
        }
    }
}
using ___int = int;
#define int ll
const ll MOD = 1'000'000'007;
ll fact(ll x, ll y) {
    ll ans = 1;
    for (ll i = 2; i <= x; ++i) {
        if (i == y) continue;
        ans *= i;
        ans %= MOD;
    }
    return ans;
}

void $main() {
    ll n;
    cin >> n;
    vector<ll> a;
    readVectors((___int)n, a);
    map<ll, ll> m;
    for (auto x : a) ++m[x];
    ll ans = 0;
    ll mul = 1;
    ll maxVal = *max_element(a.begin(), a.end());
    ll k = 0;
    for (auto it : m) {
        auto[num, count] = it;
        if (num == maxVal) continue;
        mul = 0;
        for (ll i = 0; i <= k; ++i) {
            mul += fact(n, n - i);
            mul %= MOD;
        }
        ll dans = num;
        dans %= MOD;

        dans *= count;
        dans %= MOD;

        dans *= mul;
        dans %= MOD;

        ans += dans;
        ans %= MOD;
        k += count;
        //pref += count;
    }
    cout << ans << "\n";
    //sort(a.begin(), a.end());
}


#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV) || defined(OCL)
#define DEV 1
#else
#define DEV 0
#endif
#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV)
#define DEV 1
#else
#define DEV 0
#pragma GCC optimize("O3")
#endif
#if defined(__GNUC__) || defined(OCL)
#include <bits/stdc++.h>
#else

#if DEV
#include "../allstd.h"
#else
#ifndef OCL
#include "no-such-header.h"
#endif
#endif
#endif
//opl includes go here
using namespace std;

template<typename... Vectors>
void resizeVectors(int newSize, Vectors& ...vectors) {
    (vectors.resize(newSize), ...);
}

void resizeVectors(int unusedNewSize) {

}

template<typename... Vectors>
void readEntryHelper(int i, Vectors& ...vectors) {
    ((cin >> vectors[i]), ...);
}

template<typename... Vectors>
void readVectors(int count, Vectors& ...vectors) {
    (resizeVectors(count, (vectors, ...)));
    for (int i = 0; i < count; ++i) {
        (readEntryHelper(i, (vectors, ...)));
    }
}

using ll = signed long long;
using ld = long double;
void $main();
int main() {
    int numTests = 1;
    if (DEV) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        cin >> numTests;
    } else {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
    }
    for (int i = 0; i < numTests; ++i) {
        $main();
        if (DEV) {
            cout << "-----\n";
        }
    }
}

const ll MOD = (ll) 1e9 + 7;
ll fact(int x, int y) {
    ll ans = 1;
    for (int i = 1; i <= x; ++i) {
        if (i == y) continue;
        ans *= i;
        ans %= MOD;
    }
    return ans;
}

void $main() {
    int n;
    cin >> n;
    vector<int> a;
    readVectors(n, a);
    map<int, int> m;
    for (auto x : a) ++m[x];
    ll ans = 0;
    ll mul = 1;
    int maxVal = *max_element(a.begin(), a.end());
    int k = 0;
    for (auto it : m) {
        auto[num, count] = it;
        if (num == maxVal) continue;
        //we can take every subset of pref
        mul = 0;
        for (int i = 0; i <= k; ++i) {
            mul += fact(n, n - i);
            mul %= MOD;
        }
        ll dans = num;
        dans %= MOD;
        dans*=count;
        dans %= MOD;
        dans *= mul;
        dans %= MOD;
        ans += dans;
        ans %= MOD;
        k += count;
        //pref += count;
    }
    cout << ans << "\n";
    //sort(a.begin(), a.end());
}


#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV) || defined(OCL)
#define DEV 1
#else
#define DEV 0
#endif
#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV)
#define DEV 1
#else
#define DEV 0
#pragma GCC optimize("O3")
#endif
#if defined(__GNUC__) || defined(OCL)
#include <bits/stdc++.h>
#else

#if DEV
#include "../allstd.h"
#else
#ifndef OCL
#include "no-such-header.h"
#endif
#endif
#endif
//opl includes go here
using namespace std;

template<typename... Vectors>
void resizeVectors(int newSize, Vectors& ...vectors) {
    (vectors.resize(newSize), ...);
}

void resizeVectors(int unusedNewSize) {

}

template<typename... Vectors>
void readEntryHelper(int i, Vectors& ...vectors) {
    ((cin >> vectors[i]), ...);
}

template<typename... Vectors>
void readVectors(int count, Vectors& ...vectors) {
    (resizeVectors(count, (vectors, ...)));
    for (int i = 0; i < count; ++i) {
        (readEntryHelper(i, (vectors, ...)));
    }
}

using ll = signed long long;
using ld = long double;
void $main();
int main() {
    int numTests = 1;
    if (DEV) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        cin >> numTests;
    } else {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
    }
    for (int i = 0; i < numTests; ++i) {
        $main();
        if (DEV) {
            cout << "-----\n";
        }
    }
}

const ll MOD = (ll) 1e9 + 7;
ll fact(int x, int y) {
    ll ans = 1;
    for (int i = 1; i <= x; ++i) {
        if (i == y) continue;
        ans *= i;
        ans %= MOD;
    }
    return ans;
}

void $main() {
    int n;
    cin >> n;
    vector<int> a;
    readVectors(n, a);
    map<int, int> m;
    for (auto x : a) ++m[x];
    ll ans = 0;
    ll mul = 1;
    int maxVal = *max_element(a.begin(), a.end());
    int k = 0;
    for (auto it : m) {
        auto[num, count] = it;
        if (num == maxVal) continue;
        //we can take every subset of pref
        mul = 0;
        for (int i = 0; i <= k; ++i) {
            mul += fact(n, n - i);
        }
        ans += num * count * mul;

        ans %= MOD;
        k += count;
        //pref += count;
    }
    cout << ans << "\n";
    //sort(a.begin(), a.end());
}


#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV) || defined(OCL)
#define DEV 1
#else
#define DEV 0
#endif
#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV)
#define DEV 1
#else
#define DEV 0
#pragma GCC optimize("O3")
#endif
#if defined(__GNUC__) || defined(OCL)
#include <bits/stdc++.h>
#else

#if DEV
#include "../allstd.h"
#else
#ifndef OCL
#include "no-such-header.h"
#endif
#endif
#endif
//opl includes go here
using namespace std;

template<typename... Vectors>
void resizeVectors(int newSize, Vectors& ...vectors) {
    (vectors.resize(newSize), ...);
}

template<typename... Vectors>
void readEntryHelper(int i, Vectors& ...vectors) {
    ((cin >> vectors[i]), ...);
}

template<typename... Vectors>
void readVectors(int count, Vectors& ...vectors) {
    (resizeVectors(count, (vectors, ...)));
    for (int i = 0; i < count; ++i) {
        (readEntryHelper(i, (vectors, ...)));
    }
}

using ll = signed long long;
using ld = long double;
void $main();
int main() {
    int numTests = 1;
    if (DEV) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        cin >> numTests;
    } else {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
    }
    for (int i = 0; i < numTests; ++i) {
        $main();
        if (DEV) {
            cout << "-----\n";
        }
    }
}
using ___int = int;
#define int ll
const ll MOD = 1'000'000'007;
ll mfact(ll x, ll y) {
    ll ans = 1;
    for (ll i = 2; i <= x; ++i) {
        if (i == y) continue;
        ans *= i;
        ans %= MOD;
    }
    return ans;
}

ll mmod_pow(ll x, ll p) {
    ll ans = 1;
    while (p) {
        if (p % 2) {
            ans *= x;
            ans %= MOD;
        }
        x *= x;
        x %= MOD;
        p /= 2;
    }
    return ans;
}

ll minverse(ll x) {
    return mmod_pow(x, MOD - 1);
}

ll mmul(ll x, ll y) {
    return (x * y) % MOD;
}

ll mdiv(ll x, ll y) {
    return mmul(x, minverse(y));
}

ll msub(ll x, ll y) {
    return (x - y + 2 * MOD) % MOD;
}

ll madd(ll x, ll y) {
    return (x + y) % MOD;
}
void $main() {
    ll n;
    cin >> n;
    vector<ll> a;
    readVectors((___int)n, a);
    map<ll, ll> m;
    for (auto x : a) ++m[x];
    ll ans = 0;
    ll mul = 1;
    ll maxVal = *max_element(a.begin(), a.end());
    ll k = 0;
    ll f = mfact(n, n + 1);
    for (auto it : m) {
        auto[num, count] = it;
        if (num == maxVal) continue;
        //mul = 0;
        ll dans = mdiv(
            mmul(num, f),
            msub(n, k)
        );
        dans = mmul(dans, count);
        ans = madd(ans, dans);
        k += count;
    }
    cout << ans << "\n";
    //sort(a.begin(), a.end());
}


#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV) || defined(OCL)
#define DEV 1
#else
#define DEV 0
#endif
#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV)
#define DEV 1
#else
#define DEV 0
#pragma GCC optimize("O3")
#endif
#if defined(__GNUC__) || defined(OCL)
#include <bits/stdc++.h>
#else

#if DEV
#include "../allstd.h"
#else
#ifndef OCL
#include "no-such-header.h"
#endif
#endif
#endif
//opl includes go here
using namespace std;

template<typename... Vectors>
void resizeVectors(int newSize, Vectors& ...vectors) {
    (vectors.resize(newSize), ...);
}

void resizeVectors(int unusedNewSize) {

}

template<typename... Vectors>
void readEntryHelper(int i, Vectors& ...vectors) {
    ((cin >> vectors[i]), ...);
}

template<typename... Vectors>
void readVectors(int count, Vectors& ...vectors) {
    (resizeVectors(count, (vectors, ...)));
    for (int i = 0; i < count; ++i) {
        (readEntryHelper(i, (vectors, ...)));
    }
}

using ll = signed long long;
using ld = long double;
void $main();
int main() {
    int numTests = 1;
    if (DEV) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        cin >> numTests;
    } else {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
    }
    for (int i = 0; i < numTests; ++i) {
        $main();
        if (DEV) {
            cout << "-----\n";
        }
    }
}

const ll MOD = (ll) 1e9 + 7;
ll fact(ll x, ll y) {
    ll ans = 1;
    for (ll i = 1; i <= x; ++i) {
        if (i == y) continue;
        ans *= i;
        ans %= MOD;
    }
    return ans;
}

void $main() {
    int n;
    cin >> n;
    vector<ll> a;
    readVectors(n, a);
    map<ll, ll> m;
    for (auto x : a) ++m[x];
    ll ans = 0;
    ll mul = 1;
    int maxVal = *max_element(a.begin(), a.end());
    int k = 0;
    for (auto it : m) {
        auto[num, count] = it;
        if (num == maxVal) continue;
        //we can take every subset of pref
        mul = 0;
        for (ll i = 0; i <= k; ++i) {
            mul += fact(n, n - i);
            mul %= MOD;
        }
        ll dans = num;
        dans %= MOD;
        dans*=count;
        dans %= MOD;
        dans *= mul;
        dans %= MOD;
        ans += dans;
        ans %= MOD;
        k += count;
        //pref += count;
    }
    cout << ans << "\n";
    //sort(a.begin(), a.end());
}


#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV) || defined(OCL)
#define DEV 1
#else
#define DEV 0
#endif
#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV)
#define DEV 1
#else
#define DEV 0
#pragma GCC optimize("O3")
#endif
#if defined(__GNUC__) || defined(OCL)
#include <bits/stdc++.h>
#else

#if DEV
#include "../allstd.h"
#else
#ifndef OCL
#include "no-such-header.h"
#endif
#endif
#endif
//opl includes go here
using namespace std;

template<typename... Vectors>
void resizeVectors(int newSize, Vectors& ...vectors) {
    (vectors.resize(newSize), ...);
}

void resizeVectors(int unusedNewSize) {

}

template<typename... Vectors>
void readEntryHelper(int i, Vectors& ...vectors) {
    ((cin >> vectors[i]), ...);
}

template<typename... Vectors>
void readVectors(int count, Vectors& ...vectors) {
    (resizeVectors(count, (vectors, ...)));
    for (int i = 0; i < count; ++i) {
        (readEntryHelper(i, (vectors, ...)));
    }
}

using ll = signed long long;
using ld = long double;
void $main();
int main() {
    int numTests = 1;
    if (DEV) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        cin >> numTests;
    } else {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
    }
    for (int i = 0; i < numTests; ++i) {
        $main();
        if (DEV) {
            cout << "-----\n";
        }
    }
}
#define int ll
const ll MOD = 1'000'000'007;
ll fact(ll x, ll y) {
    ll ans = 1;
    for (ll i = 1; i <= x; ++i) {
        if (i == y) continue;
        ans *= i;
        ans %= MOD;
    }
    return ans;
}

void $main() {
    int n;
    cin >> n;
    vector<ll> a;
    readVectors(n, a);
    map<ll, ll> m;
    for (auto x : a) ++m[x];
    ll ans = 0;
    ll mul = 1;
    ll maxVal = *max_element(a.begin(), a.end());
    ll k = 0;
    for (auto it : m) {
        auto[num, count] = it;
        if (num == maxVal) continue;
        //we can take every subset of pref
        mul = 0;
        for (ll i = 0; i <= k; ++i) {
            mul += fact(n, n - i);
            mul %= MOD;
        }
        ll dans = num;
        dans %= MOD;
        dans*=count;
        dans %= MOD;
        dans *= mul;
        dans %= MOD;
        ans += dans;
        ans %= MOD;
        k += count;
        //pref += count;
    }
    cout << ans << "\n";
    //sort(a.begin(), a.end());
}


#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV) || defined(OCL)
#define DEV 1
#else
#define DEV 0
#endif
#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV)
#define DEV 1
#else
#define DEV 0
#pragma GCC optimize("O3")
#endif
#if defined(__GNUC__) || defined(OCL)
#include <bits/stdc++.h>
#else

#if DEV
#include "../allstd.h"
#else
#ifndef OCL
#include "no-such-header.h"
#endif
#endif
#endif
//opl includes go here
using namespace std;

template<typename... Vectors>
void resizeVectors(int newSize, Vectors& ...vectors) {
    (vectors.resize(newSize), ...);
}

void resizeVectors(int unusedNewSize) {

}

template<typename... Vectors>
void readEntryHelper(int i, Vectors& ...vectors) {
    ((cin >> vectors[i]), ...);
}

template<typename... Vectors>
void readVectors(int count, Vectors& ...vectors) {
    (resizeVectors(count, (vectors, ...)));
    for (int i = 0; i < count; ++i) {
        (readEntryHelper(i, (vectors, ...)));
    }
}

using ll = signed long long;
using ld = long double;
void $main();
int main() {
    int numTests = 1;
    if (DEV) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        cin >> numTests;
    } else {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
    }
    for (int i = 0; i < numTests; ++i) {
        $main();
        if (DEV) {
            cout << "-----\n";
        }
    }
}
using ___int = int;
#define int ll
const ll MOD = 1'000'000'007;
ll fact(ll x, ll y) {
    ll ans = 1;
    for (ll i = 1; i <= x; ++i) {
        if (i == y) continue;
        ans *= i;
        ans %= MOD;
    }
    return ans;
}

void $main() {
    int n;
    cin >> n;
    vector<ll> a;
    readVectors((___int)n, a);
    map<ll, ll> m;
    for (auto x : a) ++m[x];
    ll ans = 0;
    ll mul = 1;
    ll maxVal = *max_element(a.begin(), a.end());
    ll k = 0;
    for (auto it : m) {
        auto[num, count] = it;
        if (num == maxVal) continue;
        //we can take every subset of pref
        mul = 0;
        for (ll i = 0; i <= k; ++i) {
            mul += fact(n, n - i);
            mul %= MOD;
        }
        ll dans = num;
        dans %= MOD;
        dans*=count;
        dans %= MOD;
        dans *= mul;
        dans %= MOD;
        ans += dans;
        ans %= MOD;
        k += count;
        //pref += count;
    }
    cout << ans << "\n";
    //sort(a.begin(), a.end());
}


#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV) || defined(OCL)
#define DEV 1
#else
#define DEV 0
#endif
#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV)
#define DEV 1
#else
#define DEV 0
#pragma GCC optimize("O3")
#endif
#if defined(__GNUC__) || defined(OCL)
#include <bits/stdc++.h>
#else

#if DEV
#include "../allstd.h"
#else
#ifndef OCL
#include "no-such-header.h"
#endif
#endif
#endif
//opl includes go here
using namespace std;

template<typename... Vectors>
void resizeVectors(int newSize, Vectors& ...vectors) {
    (vectors.resize(newSize), ...);
}

template<typename... Vectors>
void readEntryHelper(int i, Vectors& ...vectors) {
    ((cin >> vectors[i]), ...);
}

template<typename... Vectors>
void readVectors(int count, Vectors& ...vectors) {
    (resizeVectors(count, (vectors, ...)));
    for (int i = 0; i < count; ++i) {
        (readEntryHelper(i, (vectors, ...)));
    }
}

using ll = signed long long;
using ld = long double;
void $main();
int main() {
    int numTests = 1;
    if (DEV) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        cin >> numTests;
    } else {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
    }
    for (int i = 0; i < numTests; ++i) {
        $main();
        if (DEV) {
            cout << "-----\n";
        }
    }
}
using ___int = int;
#define int ll
const ll MOD = 1'000'000'007;
ll fact(ll x, ll y) {
    ll ans = 1;
    for (ll i = 2; i <= x; ++i) {
        if (i == y) continue;
        ans *= i;
        ans %= MOD;
    }
    return ans;
}

void $main() {
    ll n;
    cin >> n;
    vector<ll> a;
    readVectors((___int)n, a);
    map<ll, ll> m;
    for (auto x : a) ++m[x];
    ll ans = 0;
    ll mul = 1;
    ll maxVal = *max_element(a.begin(), a.end());
    ll k = 0;
    ll lastK = 0;
    for (auto it : m) {
        auto[num, count] = it;
        if (num == maxVal) continue;
        //mul = 0;

        ll dans = num;
        dans %= MOD;

        dans *= count;
        dans %= MOD;

        dans *= mul;
        dans %= MOD;

        ans += dans;
        ans %= MOD;
        k += count;
        for (ll i = lastK+1; i <= k; ++i) {
            mul += fact(n, n - i);
            mul %= MOD;
        }
        lastK = k;
        //pref += count;
    }
    cout << ans << "\n";
    //sort(a.begin(), a.end());
}


#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV) || defined(OCL)
#define DEV 1
#else
#define DEV 0
#endif
#define LOCAL_GCC 0 // CHANGEME
#if defined(_DEV)
#define DEV 1
#else
#define DEV 0
#pragma GCC optimize("O3")
#endif
#if defined(__GNUC__) || defined(OCL)
#include <bits/stdc++.h>
#else

#if DEV
#include "../allstd.h"
#else
#ifndef OCL
#include "no-such-header.h"
#endif
#endif
#endif
//opl includes go here
using namespace std;

template<typename... Vectors>
void resizeVectors(int newSize, Vectors& ...vectors) {
    (vectors.resize(newSize), ...);
}

void resizeVectors(int unusedNewSize) {

}

template<typename... Vectors>
void readEntryHelper(int i, Vectors& ...vectors) {
    ((cin >> vectors[i]), ...);
}

template<typename... Vectors>
void readVectors(int count, Vectors& ...vectors) {
    (resizeVectors(count, (vectors, ...)));
    for (int i = 0; i < count; ++i) {
        (readEntryHelper(i, (vectors, ...)));
    }
}

using ll = signed long long;
using ld = long double;
void $main();
int main() {
    int numTests = 1;
    if (DEV) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        cin >> numTests;
    } else {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
    }
    for (int i = 0; i < numTests; ++i) {
        $main();
        if (DEV) {
            cout << "-----\n";
        }
    }
}

const ll MOD = 1'000'000'007;
ll fact(ll x, ll y) {
    ll ans = 1;
    for (ll i = 1; i <= x; ++i) {
        if (i == y) continue;
        ans *= i;
        ans %= MOD;
    }
    return ans;
}

void $main() {
    int n;
    cin >> n;
    vector<ll> a;
    readVectors(n, a);
    map<ll, ll> m;
    for (auto x : a) ++m[x];
    ll ans = 0;
    ll mul = 1;
    ll maxVal = *max_element(a.begin(), a.end());
    ll k = 0;
    for (auto it : m) {
        auto[num, count] = it;
        if (num == maxVal) continue;
        //we can take every subset of pref
        mul = 0;
        for (ll i = 0; i <= k; ++i) {
            mul += fact(n, n - i);
            mul %= MOD;
        }
        ll dans = num;
        dans %= MOD;
        dans*=count;
        dans %= MOD;
        dans *= mul;
        dans %= MOD;
        ans += dans;
        ans %= MOD;
        k += count;
        //pref += count;
    }
    cout << ans << "\n";
    //sort(a.begin(), a.end());
}


//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};
vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

template< typename T >
struct Combination {
  vector< T > _fact, _rfact, _inv;

  Combination(ll sz) : _fact(sz + 1), _rfact(sz + 1), _inv(sz + 1) {
    _fact[0] = _rfact[sz] = _inv[0] = 1;
    for(ll i = 1; i <= sz; i++) _fact[i] = _fact[i - 1] * i;
    _rfact[sz] /= _fact[sz];
    for(ll i = sz - 1; i >= 0; i--) _rfact[i] = _rfact[i + 1] * (i + 1);
    for(ll i = 1; i <= sz; i++) _inv[i] = _rfact[i] * _fact[i - 1];
  }

  inline T fact(ll k) const { return _fact[k]; }

  inline T rfact(ll k) const { return _rfact[k]; }

  inline T inv(ll k) const { return _inv[k]; }

  T P(ll n, ll r) const {
    if(r < 0 || n < r) return 0;
    return fact(n) * rfact(n - r);
  }

  T C(ll p, ll q) const {
    if(q < 0 || p < q) return 0;
    return fact(p) * rfact(q) * rfact(p - q);
  }

  T H(ll n, ll r) const {
    if(n < 0 || r < 0) return (0);
    return r == 0 ? 1 : C(n + r - 1, r);
  }
};
using modint = ModInt< MOD1 >;modint pow(ll n, ll x){return modint(n).pow(x);}modint pow(modint n, ll x){return n.pow(x);}
//using modint=ld;
using Comb=Combination<modint>;

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  Comb comb(1000005);
  ll n;cin>>n;
  vector<ll>a(n);
  rep(i,0,n)cin>>a[i];
  sort(ALL(a));
  modint ret=0;
  vector<ll>b(n);
  rep(i,0,n)b[i]=n-i;
  rep(i,0,n-1){
    if(a[i]==a[i+1])b[i+1]=b[i];
  }
  rep(i,0,n){
    if(a[i]!=a.back())ret+=comb.inv(b[i])*a[i];
  }
  ret*=comb.fact(n);
  cout<<ret<<endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const int N = 1e6 + 5;
const ll mod = 1e9 + 7;

ll mul(ll x, ll y) {
   return x * y % mod;
}
ll pw(ll x, ll i) {
    ll b = 1;
    for(; i; i >>= 1, x = x * x % mod) if(i & 1ll) b = b * x % mod;
    return b;
}

int n;
ll a[N], s[N], fac[N], inv[N];

ll ckn(int n, int k) {
    return fac[n] * inv[n - k] % mod * inv[k] % mod;
}
ll calc(int k) {
    return fac[n - k - 1] * inv[n - k + 1] % mod;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i];
    fac[0] = 1;
    for(int i = 1; i <= n; ++i) fac[i] = mul(fac[i - 1], i);
    inv[n + 1] = 1;
    for(int i = n; i >= 0; --i) inv[i] = inv[i + 1] * i % mod;
    int ans = 0, cur = 0, cnt = 0;
    for(int i = 1; i <= n, a[i] != a[n]; ++i) {
        if(a[i] == a[i - 1]) cnt++;
        else cur += cnt, cnt = 1;
        ans = (ans + mul(a[i], calc(cur))) % mod;
    }
    cout << ans << '\n';
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const int N = 1e6 + 5;
const ll mod = 1e9 + 7;

ll mul(ll x, ll y) {
   return x * y % mod;
}
ll pw(ll x, ll i) {
    ll b = 1;
    for(; i; i >>= 1, x = x * x % mod) if(i & 1ll) b = b * x % mod;
    return b;
}

int n;
ll a[N], s[N], fac[N], inv[N];

ll ckn(int n, int k) {
    return fac[n] * inv[n - k] % mod * inv[k] % mod;
}
ll calc(int k) {
    return fac[n - k - 1] * inv[n - k + 1] % mod;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i];
    sort(a + 1, a + n + 1);
    fac[0] = 1;
    for(int i = 1; i <= n; ++i) fac[i] = mul(fac[i - 1], i);
    inv[n + 1] = 1;
    for(int i = n; i >= 0; --i) inv[i] = inv[i + 1] * i % mod;
    int ans = 0, cur = 0, cnt = 0;
    for(int i = 1; i <= n, a[i] != a[n]; ++i) {
        if(a[i] == a[i - 1]) cnt++;
        else cur += cnt, cnt = 1;
        ans = (ans + mul(a[i], calc(cur))) % mod;
    }
    cout << ans << '\n';
}


#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
using namespace std;
long long mod = 1e9 + 7;
long long power(long long x,long long n){
	long long ret = 1;
	while(n){
		if(n & 1) ret = ret * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return ret;
}
long long fac1[1000005],ret[1000005],fac2[1000005];
long long num[1000005];
long long A(long long x){
	return fac1[x];
}
long long C(long long x,long long y){
	long long ret = fac1[x];
	ret = ret * fac2[y] % mod * fac2[x-y] % mod;
	return ret;
}
int main()
{
	int n;
	scanf("%d",&n);
	fac1[0] = 1;
	for(int i = 1;i <= n;++i) fac1[i] = fac1[i-1] * i % mod;
	fac2[0] = 1;
	for(int i = 1;i <= n;++i){
		ret[i] = power(i,mod-2);
		fac2[i] = fac2[i-1] * ret[i] % mod;
	}
	for(int i = 1;i <= n;++i) scanf("%lld",&num[i]);
	sort(num+1,num+n+1);
	long long ans = 0;
	int temp = 1;
	for(int i = 1;i <= n;++i){
		if(num[i] != num[i-1]) temp = i;
		if(num[i] != num[n])
			ans += (A(temp-1) * num[i] % mod * A(n-temp) % mod * C(n,temp-1) % mod);
		//cout << ans << endl;
		ans %= mod;
	}
	cout << ans << endl;

	return 0;
}


#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
using namespace std;
long long mod = 1e9 + 7;
long long power(long long x,long long n){
	long long ret = 1;
	while(n){
		if(n & 1) ret = ret * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return ret;
}
long long fac1[1000005],ret[1000005],fac2[1000005];
long long num[1000005];
long long A(long long x){
	return fac1[x];
}
long long C(long long x,long long y){
	long long ret = fac1[x];
	ret = ret * fac2[y] % mod * fac2[x-y] % mod;
	return ret;
}
int main()
{
	int n;
	scanf("%d",&n);
	fac1[0] = 1;
	for(int i = 1;i <= n;++i) fac1[i] = fac1[i-1] * i % mod;
	fac2[0] = 1;
	for(int i = 1;i <= n;++i){
		ret[i] = power(i,mod-2);
		fac2[i] = fac2[i-1] * ret[i] % mod;
	}
	for(int i = 1;i <= n;++i) scanf("%lld",&num[i]);
	sort(num+1,num+n+1);
	long long ans = 0;
	int temp = 1;
	for(int i = 1;i <= n;++i){
		if(num[i] != num[i-1]) temp = i;
		if((num[i] != num[n])
			ans += (A(temp-1) * num[i] % mod * A(n-temp) % mod * C(n,temp-1) % mod);
		//cout << ans << endl;
		ans %= mod;
	}
	cout << ans << endl;

	return 0;
}


#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
using namespace std;
long long mod = 1e9 + 7;
long long power(long long x,long long n){
	long long ret = 1;
	while(n){
		if(n & 1) ret = ret * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return ret;
}
long long fac1[1000005],ret[1000005],fac2[1000005];
long long num[1000005];
long long A(long long x){
	return fac1[x];
}
long long C(long long x,long long y){
	long long ret = fac1[x];
	ret = ret * fac2[y] % mod * fac2[x-y] % mod;
	return ret;
}
int main()
{
	int n;
	scanf("%d",&n);
	fac1[0] = 1;
	for(int i = 1;i <= n;++i) fac1[i] = fac1[i-1] * i % mod;
	fac2[0] = 1;
	for(int i = 1;i <= n;++i){
		ret[i] = power(i,mod-2);
		fac2[i] = fac2[i-1] * ret[i] % mod;
	}
	for(int i = 1;i <= n;++i) scanf("%lld",&num[i]);
	sort(num+1,num+n+1);
	long long ans = 0;
	int temp = 1;
	for(int i = 1;i <= n;++i){
		if(num[i] != num[i-1]) temp = i;
		if((i == n && temp != n) || i != n)
			ans += (A(temp-1) * num[i] % mod * A(n-temp) % mod * C(n,temp-1) % mod);
		ans %= mod;
		//printf("%lld  %lld %lld\n",A(i-1),A(n-i),C(n,i-1));
	}
	cout << ans << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;

#define endl '\n'
#define ff first
#define ss second
#define int long long
#define pb push_back
#define f(i,l,r) for(ll i=l;i<=r;i++)
#define rf(i,r,l) for(ll i=r;i>=l;i--)
#define Max 5000001
#define inf 2147483647
#define llinf 9223372036854775807
#define all(v) v.begin(),v.end()
#define bp(n) __builtin_popcountll(n)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

#define d0(a) cout<<a<<' ';
#define d1(a) cout<<a<<endl;
#define d2(a,b) cout<<a<<' '<<b<<endl;
#define d3(a,b,c) cout<<a<<' '<<b<<' '<<c<<endl;
#define d4(a,b,c,d) cout<<a<<' '<<b<<' '<<c<<' '<<d<<endl;
#define d5(a,b,c,d,e) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<endl;
#define d6(a,b,c,d,e,f) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<endl;

const ll N=1e6+5,mod=1e9+7,bit=61;

ll fact[N],ifact[N];

ll powerm(ll a,ll b,ll m=mod)
{
	a%=m;
	ll res=1%m;
	while(b>0)
	{
		if(b & 1)
		{
			res=(res*a)%m;
		}
		b>>=1;
		a=(a*a)%m;
	}
	return res;
}

void pre()
{
    fact[0]=1;
    for(int i=1;i<N;i++)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
    ifact[N-1]=powerm(fact[N-1],mod-2);
    for(int i=N-2;i>=0;i--)
    {
        ifact[i]=(ifact[i+1] * (i+1))%mod;
    }
}

ll ncr(ll n,ll r)
{
    if(r>n)
    {
        return 0;
    }
    ll ans=(ifact[r] * ifact[n-r])%mod;
    ans=(ans * fact[n])%mod;
    return ans;
}

signed main()
{
    fast;

    pre();
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        ll a[n],mx=0;
        f(i,0,n-1)
        {
            cin>>a[i];
            mx=max(mx,a[i]);
        }
        sort(a,a+n);
        ll ans=0;
        f(i,0,n-1)
        {
            if(a[i]==mx)
            {
                break;
            }
            ll l=lower_bound(a,a+n,a[i])-a;
            ll mul=(fact[l]*fact[n-l-1])%mod;
            mul=(mul * ncr(n,l))%mod;
            ans=(ans + mul*a[i])%mod;
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <memory.h>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef pair<int, int> PII;
const double pi = 3.1415926535897932384626433832795;
const double eps = 1e-12;
const int INF = 1<<30;
const LL LINF = 1LL<<62;

#define pb push_back
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
#define CLR(a, v) memset((a),(v),sizeof(a))
#define sqr(a) ((a)*(a))
const int BUFFER_SZ = 1 << 10;
const int MOD = 1000*1000*1000+7;

char BUFFER[BUFFER_SZ];
int gi() { int x; scanf("%d", &x); return x; }
LL gll() { LL x; scanf("%lld", &x); return x; }
VI gvi(int n) { VI a; while(n-->0) a.pb(gi()); return a;}
string gs() { scanf("%s", BUFFER); return string(BUFFER); }
template <class T> void print(vector<T> &x, string format) {
  format += "%c";
  for (int i = 0; i < x.size(); ++i) printf(format.c_str(), x[i], i+1==x.size() ? '\n' : ' ');
}
// ---------------------------------------------------------- //

int F[1<<20];
int INV[1<<20];

int solve(VI &A) {
  INV[1]=1;
  F[0]=1;
  for (int i = 1; i <= A.size(); ++i) F[i] = 1ll*F[i-1]*i%MOD;
  for (int i = 2; i <= A.size(); ++i) {
    INV[i] = (MOD-1ll*(MOD/i)*INV[MOD%i]%MOD)%MOD;
  }
  int res = 0;
  sort(ALL(A));
  map<int,int> M;
  for (int x : A) ++M[x];
  VI V; for (auto x : M) V.pb(x.first);
  int a = 0;
  int b = A.size();
  for (int p = 0; p < V.size()-1; ++p) {
    int v = 0;
    int w = M[V[p]];
    v = 1ll*F[a+b]*INV[b]%MOD;
    res += 1ll*v * (1ll*V[p]*w %MOD) % MOD;
    res %= MOD;
    b-=w;
    a+=w;
  }
  return res;
}

int main() {
#ifdef DEAD_RABBIT
  freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  clock_t start = clock();
#endif
  int n = gi();
  VI a = gvi(n);
  printf("%d\n", solve(a));
#ifdef DEAD_RABBIT
  fprintf(stderr, "Time: %.3lf\n", 1.0*(clock()-start)/CLOCKS_PER_SEC);
#endif
  return 0;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <memory.h>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef pair<int, int> PII;
const double pi = 3.1415926535897932384626433832795;
const double eps = 1e-12;
const int INF = 1<<30;
const LL LINF = 1LL<<62;

#define pb push_back
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
#define CLR(a, v) memset((a),(v),sizeof(a))
#define sqr(a) ((a)*(a))
const int BUFFER_SZ = 1 << 10;
const int MOD = 1000*1000*1000+7;

char BUFFER[BUFFER_SZ];
int gi() { int x; scanf("%d", &x); return x; }
LL gll() { LL x; scanf("%lld", &x); return x; }
VI gvi(int n) { VI a; while(n-->0) a.pb(gi()); return a;}
string gs() { scanf("%s", BUFFER); return string(BUFFER); }
template <class T> void print(vector<T> &x, string format) {
  format += "%c";
  for (int i = 0; i < x.size(); ++i) printf(format.c_str(), x[i], i+1==x.size() ? '\n' : ' ');
}
// ---------------------------------------------------------- //

int F[1<<20];
int INV[1<<20];

int solve(VI &A) {
  INV[1]=1;
  F[0]=1;
  for (int i = 1; i <= A.size(); ++i) F[i] = F[i-1]*i;
  for (int i = 2; i <= A.size(); ++i) {
    INV[i] = (MOD-1ll*(MOD/i)*INV[MOD%i]%MOD)%MOD;
  }
  int res = 0;
  sort(ALL(A));
  map<int,int> M;
  for (int x : A) ++M[x];
  VI V; for (auto x : M) V.pb(x.first);
  int a = 0;
  int b = A.size();
  for (int p = 0; p < V.size()-1; ++p) {
    int v = 0;
    int w = M[V[p]];
    v = 1ll*F[a+b]*INV[b]%MOD;
    res += v * V[p] * w;
    b-=w;
    a+=w;
  }
  return res;
}

int main() {
#ifdef DEAD_RABBIT
  freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  clock_t start = clock();
#endif
  int n = gi();
  VI a = gvi(n);
  printf("%d\n", solve(a));
#ifdef DEAD_RABBIT
  fprintf(stderr, "Time: %.3lf\n", 1.0*(clock()-start)/CLOCKS_PER_SEC);
#endif
  return 0;
}