#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int maxn = 1e6 + 1;
const int mod = 1e9 + 7;
map<long long, int> a;
long long f[maxn], inv[maxn];
long long power(long long base, long long p) {
  long long ret = 1;
  while (p) {
    if (p & 1) ret = ret * base % mod;
    base = base * base % mod;
    p >>= 1;
  }
  return ret;
}
void init() {
  f[0] = 1;
  for (long long i = 1; i < maxn; ++i) f[i] = f[i - 1] * i % mod;
  inv[maxn - 1] = power(f[maxn - 1], mod - 2);
  for (long long i = maxn - 1; i >= 1; --i) inv[i - 1] = inv[i] * i % mod;
}
long long cb(long long n, long long k) {
  if (n < k || k < 0) return 0;
  return f[n] * inv[k] % mod * inv[n - k] % mod;
}
int main() {
  init();
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    a[x] += 1;
  }
  long long ans = 0;
  long long prev = 0;
  int sz = a.size();
  auto it = a.begin();
  for (int i = 0; i < sz - 1; ++i) {
    auto pr = *it;
    long long v = pr.first;
    long long cnt = pr.second;
    ans = (ans + cnt * f[n - prev - 1] % mod * v % mod * f[prev] % mod *
                     cb(n, n - prev) % mod) %
          mod;
    prev += cnt;
    ++it;
  }
  printf("%lld\n", ans);
}
