#include <bits/stdc++.h>
using namespace std;
int n;
const int mod = 1e9 + 7;
long long jc, a[1000010], ans = 0ll;
int qpow(int x, int n) {
  int ans = 1;
  for (; n; n >>= 1, x = 1ll * x * x % mod)
    if (n & 1) ans = 1ll * ans * x % mod;
  return ans;
}
long long cal(long long x) {
  long long tmp = (jc * qpow(n - x + 1, mod - 2) % mod) * a[x] % mod;
  return tmp;
}
int main() {
  scanf("%d", &n);
  jc = 1LL;
  for (long long i = 1; i <= n; i++) {
    jc = jc * i % mod;
  }
  for (long long i = 1LL; i <= n; i++) scanf("%I64d", &a[i]);
  sort(a + 1, a + n + 1);
  if (a[1] == a[n]) {
    printf("0\n");
    return 0;
  }
  for (long long i = 1LL; i <= n; i++) {
    long long j = i;
    while (a[j + 1] == a[i] && j < n) j++;
    if (j == n) break;
    ans = (ans + cal(i) * (j - i + 1) % mod) % mod;
    i = j;
  }
  printf("%I64d\n", ans);
}
