#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
map<long long, long long> mp;
vector<long long> vec;
long long F[1000003];
long long pwr(long long a, int b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0) {
    long long temp = pwr(a, b / 2);
    return (temp * temp) % MOD;
  } else
    return (pwr(a, b - 1) * a) % MOD;
}
long long xxx2[1000003];
long long fac(long long n) {
  if (n <= 1)
    return 1LL;
  else if (xxx2[n])
    return xxx2[n];
  else
    return xxx2[n] = (fac(n - 1) * n) % MOD;
}
bool sudah = 0;
long long xxx[1000003];
long long seperxxx[1000003];
void precomputeCOMBIN(long long n) {
  for (int i = 0; i <= n; i++) {
    xxx[i] = fac(i);
    seperxxx[i] = pwr(fac(i), MOD - 2);
  }
}
long long C(long long n, long long k) {
  if (!sudah) {
    precomputeCOMBIN(1000000);
    sudah = 1;
  }
  long long res = xxx[n] * seperxxx[k];
  res %= MOD;
  res *= seperxxx[n - k];
  res %= MOD;
  return res;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    long long x;
    scanf("%lld", &x);
    mp[x]++;
    if (mp[x] == 1) vec.push_back(x);
  }
  vec.push_back((long long)2e9);
  sort(vec.begin(), vec.end(), greater<long long>());
  for (auto it = vec.begin(); it != vec.end(); it++) {
    auto jt = it;
    jt++;
    if (jt == vec.end()) break;
    mp[*jt] += mp[*it];
  }
  mp[(long long)2e9] = 0;
  long long res = 0;
  for (auto it = vec.begin(); it != vec.end(); it++) {
    auto jt = it;
    jt++;
    if (jt == vec.end()) break;
    long long pit = mp[*it];
    long long b = mp[*jt] - pit;
    long long big = pit;
    if (big == 0) continue;
    long long dec = 1;
    dec *= C(n, big + b);
    dec %= MOD;
    dec *= fac(big + b - 1);
    dec %= MOD;
    dec *= b;
    dec %= MOD;
    dec *= fac(n - big - b);
    dec %= MOD;
    res += ((dec % MOD) * (*jt)) % MOD;
    res %= MOD;
  }
  printf("%lld\n", res);
}
