#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10, M = 1e9 + 7;
int n, k, A[maxn], factn = 1;
int power(int a, int b) {
  if (b == 0) return 1;
  int ans = power(1ll * a * a % M, b >> 1);
  if (b & 1) ans = 1ll * ans * a % M;
  return ans;
}
int32_t main() {
  scanf("%d", &n);
  for (int i = int(0); i < int(n); i++) {
    factn = 1ll * factn * (i + 1) % M;
    scanf("%d", A + i);
  }
  sort(A, A + n);
  int pos = 0, ans = 0;
  for (int i = int(0); i < int(n); i++) {
    while (pos < n && A[pos] < A[i]) pos++;
    if (A[i] < A[n - 1]) {
      ans = (ans + 1ll * A[i] * (1ll * factn * power(n - pos, M - 2) % M) % M) %
            M;
    }
  }
  printf("%d\n", ans);
}
