#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  if (b % 2 == 1) return (power(a, b - 1) * a) % 1000000007;
  long long int q = power(a, b / 2);
  return (q * q) % 1000000007;
}
long long int inverse(long long int a) { return power(a, 1000000007 - 2); }
int main() {
  std::ios::sync_with_stdio(false);
  int T;
  T = 1;
  while (T--) {
    int n, i, j;
    cin >> n;
    long long int ar[n];
    for (i = 0; i < n; ++i) cin >> ar[i];
    sort(ar, ar + n);
    long long int fact = 1;
    for (i = 1; i <= n; ++i) fact = (fact * i) % 1000000007;
    long long int ct = n - 1, ans = 0;
    for (i = 0; i < n; ++i) {
      if (ar[i] == ar[n - 1]) break;
      if (i > 0 && ar[i] != ar[i - 1]) ct = n - 1 - i;
      ans = (ans + inverse(ct + 1) * ar[i]) % 1000000007;
    }
    ans = (ans * fact) % 1000000007;
    cout << ans << endl;
  }
  return 0;
}
