#include <bits/stdc++.h>
using namespace std;
const int maxn = 10;
static const long long mod = 1e9 + 7;
long long inv(long long a1) {
  long long a0 = mod;
  long long s0 = 1, s1 = 0, t0 = 0, t1 = 1, q, t;
  while (a1) {
    q = a0 / a1;
    t = a0 - q * a1;
    a0 = a1;
    a1 = t;
    t = s0 - q * s1;
    s0 = s1;
    s1 = t;
    t = t0 - q * t1;
    t0 = t1;
    t1 = t;
  }
  return t0;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  long long *a = new long long[n + 1];
  long long *sil = new long long[n + 1];
  long long *ile = new long long[n + 1];
  sil[0] = 1;
  long long maxv = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    maxv = max(maxv, a[i]);
    sil[i] = (sil[i - 1] * i) % mod;
  }
  long long x = sil[n - 1];
  for (int j = 1; j < n; j++) {
    ile[j] = x;
    x = (((x * (n - j + 1)) % mod) * inv(n - j)) % mod;
  }
  sort(a + 1, a + n + 1);
  long long res = 0;
  a[0] = a[1];
  int j = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] == maxv) break;
    if (a[i - 1] != a[i]) j = i;
    res = (res + (a[i] * ile[j]) % mod) % mod;
  }
  res = (res + mod) % mod;
  cout << res << endl;
  return 0;
}
