#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007, maxn = 1000010;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + c - '0', c = getchar();
  return x * f;
}
long long a[maxn], fal[maxn], inv[maxn];
inline long long C(long long x, long long y) {
  if (x < y) return 0;
  if (y == 0 || x == y) return 1;
  return fal[x] % mod * inv[y] % mod * inv[x - y] % mod;
}
inline long long ksm(long long x, long long mi, long long p) {
  long long now = x, ans = 1;
  while (mi) {
    if (mi & 1) ans = (ans * now) % p;
    now = (now * now) % p;
    mi >>= 1;
  }
  return ans;
}
inline void pre() {
  fal[0] = 1;
  inv[0] = 1;
  for (long long i = 1; i <= 1000000; i++) fal[i] = (fal[i - 1] * i) % mod;
  inv[1000000] = ksm(fal[1000000], mod - 2, mod);
  for (long long i = 999999; i >= 1; i--) inv[i] = inv[i + 1] * (i + 1) % mod;
}
signed main() {
  long long n = read(), ans = 0;
  pre();
  for (long long i = 1; i <= n; i++) a[i] = read();
  sort(a + 1, a + n + 1);
  for (long long i = 1, j; i <= n; i = j + 1) {
    j = i;
    while (a[j + 1] == a[j]) j++;
    if (j == n) break;
    ans = (ans + C(n, n - i + 1) * fal[n - i] % mod * fal[i - 1] % mod * a[i] %
                     mod * (j - i + 1) % mod) %
          mod;
  }
  printf("%lld\n", ans);
}
