#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int fact[1000005];
int anti_fact[1000005];
const int modo = 1000000007;
int power(int x, int y) {
  if (y == 0) return 1;
  int t = power(x, y / 2);
  t = (long long)t * t % modo;
  if (y % 2 == 1) t = (long long)t * x % modo;
  return t;
}
int c(int x, int y) {
  return (long long)fact[x] * anti_fact[y] % modo * anti_fact[x - y] % modo;
}
int main() {
  int n;
  scanf("%d", &n);
  int i;
  int max_val = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    max_val = max(max_val, a[i]);
  }
  fact[0] = 1;
  for (i = 1; i <= n; i++) {
    fact[i] = (long long)fact[i - 1] * i % modo;
  }
  anti_fact[n] = power(fact[n], modo - 2);
  for (i = n - 1; i >= 0; i--) {
    anti_fact[i] = (long long)anti_fact[i + 1] * (i + 1) % modo;
  }
  sort(a, a + n);
  int cnt = 0;
  int last_cnt = 0;
  int ans = 0;
  for (i = 0; i < n; i++) {
    if (a[i] == max_val) break;
    cnt++;
    if ((i == 0) || (a[i] != a[i - 1])) {
      last_cnt = cnt;
    }
    ans = (ans + (long long)a[i] * fact[last_cnt - 1] % modo *
                     fact[n - last_cnt] % modo * c(n, last_cnt - 1) % modo) %
          modo;
  }
  printf("%d\n", ans);
  return 0;
}
