#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 123;
const int md = 1e9 + 7;
int n, a[maxn];
int frac[maxn], inv[maxn];
int pwr(int a, int n) {
  int res = 1;
  while (n) {
    if (n & 1) res = 1LL * res * a % md;
    a = 1LL * a * a % md;
    n >>= 1;
  }
  return res;
}
void add(int &a, const int b) {
  a += b;
  if (a >= md) a -= md;
}
int C(int k, int n) { return 1LL * frac[n] * inv[k] % md * inv[n - k] % md; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  frac[0] = 1;
  for (int i = 1; i <= 1000000; i++) frac[i] = 1LL * i * frac[i - 1] % md;
  for (int i = 0; i <= 1000000; i++) inv[i] = pwr(frac[i], md - 2);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  int j = n + 1;
  int res = 0;
  int mxval = 0;
  for (int i = 1; i <= n; i++) mxval = max(mxval, a[i]);
  for (int i = n; i >= 1; i--) {
    while (j - 1 >= 1 && a[j - 1] >= a[i]) --j;
    int more = n - j + 1;
    if (a[i] != mxval)
      add(res, 1LL * a[i] * frac[more - 1] % md * frac[n - more] % md *
                   C(more, n) % md);
  }
  cout << res << endl;
  return 0;
}
