#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "{" << p.first << "," << p.second << "}";
  return os;
}
const long long N = 1e6 + 5;
const long long oo = 1e9 + 7;
long long bigmod(long long a, long long p, long long m) {
  long long res = 1;
  long long x = a;
  while (p) {
    if (p & 1) {
      res = (res * x) % m;
    }
    x = (x * x) % m;
    p = p >> 1;
  }
  return res;
}
long long fact[N];
long long fact_inv[N];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  fact[0] = 1;
  for (long long i = 1; i < N; i++) {
    fact[i] = (i * fact[i - 1]) % oo;
  }
  fact_inv[N - 1] = bigmod(fact[N - 1], oo - 2, oo);
  for (long long i = N - 2; i >= 0; i--) {
    fact_inv[i] = ((i + 1) * fact_inv[i + 1]) % oo;
  }
  long long n;
  cin >> n;
  map<int, int> cnt;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    cnt[x]++;
  }
  vector<pair<long long, long long> > x(cnt.begin(), cnt.end());
  long long ans = 0, sum = 0;
  for (pair<long long, long long> i : x) {
    sum += i.second;
    int nxt = n - sum;
    if (nxt) {
      ans = (ans + fact[n] * fact_inv[nxt + i.second] % oo * i.second % oo *
                       fact[nxt + i.second - 1] % oo * i.first % oo) %
            oo;
    }
  }
  ans = (ans + oo) % oo;
  cout << ans << "\n";
}
