#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 10;
const int md = 1e9 + 7;
int n, a[maxn], pos = 1;
long long fac[maxn], ans;
long long bow(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % md;
    y >>= 1;
    x = x * x % md;
  }
  return res;
}
int main() {
  scanf("%d", &n);
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % md;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  while (pos <= n) {
    int p = pos, cnt = 1;
    while (pos < n && a[pos + 1] == a[pos]) {
      cnt++;
      pos++;
    }
    if (pos == n) break;
    long long val =
        fac[n] % md * a[pos] % md * cnt % md * bow(n - p + 1, md - 2) % md;
    ans = (ans + val) % md;
    pos++;
  }
  printf("%lld\n", ans);
}
