#include <bits/stdc++.h>
using namespace std;
long long int n, a[1000005], an = 0, fact = 1;
long long int egcd(long long int aa, long long int bb, long long int &xx,
                   long long int &yy) {
  if (aa == 0) {
    xx = 0, yy = 1;
    return bb;
  }
  long long int x1, y1, dd;
  dd = egcd(bb % aa, aa, x1, y1);
  xx = y1 - (bb / aa) * x1;
  yy = x1;
  return dd;
}
long long int modinverse(long long int aa, long long int mm) {
  long long int xx, yy;
  long long int dd = egcd(aa, mm, xx, yy);
  if (dd != 1) {
    cout << "fault" << endl;
    return 0;
  }
  long long int res = (xx + mm) % mm;
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) fact = (fact * (long long int)i) % 1000000007;
  sort(a + 1, a + n + 1);
  long long int bef = 0, lol;
  for (int i = 1; i <= n; i++) {
    if (a[i] != a[n] && a[i] != bef) {
      lol = (fact * modinverse(n - i + 1, 1000000007)) % 1000000007;
      lol = (lol * a[i]) % 1000000007;
      an = (an + lol) % 1000000007;
      bef = a[i];
    } else if (a[i] == bef && a[i] != a[n])
      an = (an + lol) % 1000000007;
  }
  printf("%lld\n", an);
  return 0;
}
