#include <bits/stdc++.h>
const int inf = (1ll << 30) - 1;
const int maxn = (int)1e5 + 10;
using namespace std;
long long fact[2000100];
int mod = 1000 * 1000 * 1000 + 7;
int n;
int a[2000100];
long long binpow(long long x, int y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return res;
}
long long C(int n, int k) {
  return fact[n] * binpow(fact[n - k] * 1ll * fact[k] % mod, mod - 2) % mod;
}
void solve() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n);
  fact[0] = 1;
  for (long long i = 1; i <= 2 * n; i++) {
    fact[i] = fact[i - 1] * i % mod;
  }
  long long ans = 0;
  for (int i = 0; i < n;) {
    int j = i;
    while (i < n && a[i] == a[j]) i++;
    if (i != n) {
      ans = (ans + ((((i - j) * 1ll * C(n, j)) % mod * fact[j] % mod) * 1ll *
                    a[j] % mod) *
                       fact[n - j - 1] % mod) %
            mod;
    }
  }
  cout << ans << endl;
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
