#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e6 + 7;
const int mod = 1e9 + 7;
int a[N];
int l[N];
int c[N];
int f[N];
int binpow(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) {
      ret = (ret * 1LL * a) % mod;
      --b;
    }
    a = (a * 1LL * a) % mod;
    b >>= 1;
  }
  return ret;
}
int main() {
  f[0] = 1;
  for (int i = 1; i < N; ++i) f[i] = (f[i - 1] * 1LL * i) % mod;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  sort(a, a + n);
  c[0] = 1;
  for (int i = 1; i < n; ++i) {
    l[i] = a[i] == a[i - 1] ? l[i - 1] : l[i - 1] + c[i - 1];
    c[i] = a[i] == a[i - 1] ? c[i - 1] + 1 : 1;
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] == a[n - 1]) break;
    int v = (a[i] * 1LL * f[l[i]]) % mod;
    v = (v * 1LL * f[n - l[i] - 1]) % mod;
    v = (v * 1LL * f[n]) % mod;
    v = (v * 1LL * binpow((f[n - l[i]] * 1LL * f[l[i]]) % mod, mod - 2)) % mod;
    res = (res + v) % mod;
  }
  printf("%d\n", res);
  return 0;
}
