#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const long long mod = 1e9 + 7;
long long a[maxn], fac1[maxn], fac2[maxn];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%lld", &a[i]);
  sort(a, a + n);
  fac1[0] = 1;
  fac2[n + 1] = 1;
  fac2[n] = n;
  for (int i = 1; i <= n; ++i) fac1[i] = fac1[i - 1] * i % mod;
  for (int i = n - 1; i >= 1; --i) fac2[i] = fac2[i + 1] * i % mod;
  long long ans = 0;
  for (int i = 0, j = 1; i < n && a[i] != a[n - 1]; i = j) {
    for (j = i; a[i] == a[j]; j++)
      ;
    long long num = j - i;
    ans =
        (ans + num * ((a[i] * fac1[n - i - 1] % mod) * fac2[n - i + 1])) % mod;
  }
  cout << ans << endl;
  return 0;
}
