#include <bits/stdc++.h>
using namespace std;
long long n, ans, a[1000001], inv[1000001];
int main() {
  scanf("%I64d", &n);
  inv[1] = 1;
  for (long long i = 2; i <= n; i++)
    inv[i] = (1000000007 - 1000000007 / i) * inv[1000000007 % i] % 1000000007;
  for (long long i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  sort(a + 1, a + n + 1);
  for (long long i = 1, j = 1; i <= n; i = j) {
    while (a[j] == a[i] && j <= n) j++;
    if (j <= n)
      ans += (j - i) * a[i] % 1000000007 * inv[n - i + 1] % 1000000007;
  }
  for (long long i = 1; i <= n; i++) ans *= i, ans %= 1000000007;
  printf("%I64d\n", ans);
  return 0;
}
