#include <bits/stdc++.h>
using namespace std;
long long n, a[1000001], p = 1e9 + 7, ans;
long long ksm(long long x, long long y) {
  long long xlh = 1;
  while (y) {
    if (y & 1) xlh = xlh * x % p;
    x = x * x % p;
    y /= 2;
  }
  return xlh;
}
int main() {
  long long i, j, now;
  scanf("%lld", &n);
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  sort(a + 1, a + n + 1);
  now = 1;
  for (i = 1; i <= n; i++) now = now * i % p;
  for (i = 1; i <= n; i = j) {
    j = i;
    while (a[i] == a[j] && j <= n) j++;
    if (j <= n)
      ans =
          (ans + now * ksm(n - i + 1, p - 2) % p * (j - i) % p * a[i] % p) % p;
  }
  printf("%lld", ans);
}
