#include <bits/stdc++.h>
using namespace std;
int N;
int a[1001005];
long long fac[1001005], ifac[1001005], inv[1001005];
long long s[1001005];
long long qpow(long long x, int n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % int(1e9 + 7);
    x = x * x % int(1e9 + 7);
    n /= 2;
  }
  return res;
}
void init() {
  int NN = 1e6;
  fac[0] = ifac[0] = 1;
  for (int i = 1; i <= NN; i++) {
    fac[i] = fac[i - 1] * i % int(1e9 + 7);
  }
  ifac[NN] = qpow(fac[NN], int(1e9 + 7) - 2);
  for (int i = NN - 1; i >= 1; i--) {
    ifac[i] = (i + 1) * ifac[i + 1] % int(1e9 + 7);
  }
  s[0] = fac[N - 1];
  for (int i = 1; i <= NN; i++) {
    inv[i] = fac[i - 1] * ifac[i] % int(1e9 + 7);
    if (N - i - 1 >= 0)
      s[i] =
          (s[i - 1] + ifac[i] * fac[N - i - 1] % int(1e9 + 7)) % int(1e9 + 7);
  }
}
long long comb(int n, int k) {
  if (n < 0 || k < 0 || n < k) return 0;
  return fac[n] * ifac[k] % int(1e9 + 7) * ifac[n - k] % int(1e9 + 7);
}
map<int, int> cnt;
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    ++cnt[a[i]];
  }
  init();
  long long ans = 0, ans1;
  int x, n, n0 = 0, n1;
  map<int, int>::iterator p;
  for (p = cnt.begin(); p != cnt.end(); p++) {
    x = p->first;
    n = p->second;
    n1 = N - n - n0;
    if (n1)
      ans1 = x * n % int(1e9 + 7) * fac[n0] % int(1e9 + 7) * fac[N - n0 - 1] %
             int(1e9 + 7) * comb(N, n0) % int(1e9 + 7);
    else
      ans1 = 0;
    ans = (ans + ans1) % int(1e9 + 7);
    n0 += n;
  }
  cout << ans << endl;
  return 0;
}
