#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int a[1000005];
map<int, int> ht;
map<int, int>::reverse_iterator its;
long long mul(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b % 2 == 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b /= 2;
  }
  return res;
}
int main() {
  int n;
  scanf("%d", &n);
  long long nf = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    ht[a[i]]++;
    nf = (nf * i) % mod;
  }
  int add = 0;
  long long ans = 0;
  for (its = ht.rbegin(); its != ht.rend(); its++) {
    if (add != 0)
      ans = (ans + nf * its->second % mod *
                       mul((its->second + add) % mod, mod - 2) % mod *
                       its->first % mod) %
            mod;
    add += its->second;
  }
  printf("%lld\n", ans);
}
