#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 5;
const int Mod = 1000000000 + 7;
long long inv[N];
long long a[N];
int n;
int main() {
  ;
  ;
  inv[1] = 1;
  inv[0] = 1;
  for (int i = 2; i < N; i++) {
    inv[i] = (Mod - Mod / i) * inv[Mod % i] % Mod;
  }
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) scanf("%I64d", a + i);
    long long res = 0;
    sort(a, a + n);
    for (int i = 0; i < n;) {
      int j = i;
      while (i < n && a[i] == a[j]) i++;
      if (i != n) res += (((a[j] * inv[n - j]) % Mod) * (i - j)) % Mod;
      res %= Mod;
    }
    for (int i = 1; i <= n; i++) res = (res * i) % Mod;
    cout << res << endl;
  }
}
