#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U>
ostream& operator<<(ostream& o, const pair<T, U>& p) {
  o << "(" << p.first << "," << p.second << ")";
  return o;
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& v) {
  o << "[";
  for (T t : v) {
    o << t << ",";
  }
  o << "]";
  return o;
}
const ll mod = 1e9 + 7;
ll mod_pow(ll x, ll n) {
  ll ret = 1;
  while (n) {
    if (n & 1) (ret *= x) %= mod;
    (x *= x) %= mod;
    n >>= 1;
  }
  return ret;
}
ll mod_inv(ll x) { return mod_pow(x, mod - 2); }
const int N = 1000010;
ll f[N], inv_f[N];
ll C(int n, int r) {
  ll ret = f[n];
  (ret *= inv_f[r]) %= mod;
  (ret *= inv_f[n - r]) %= mod;
  return ret;
}
int s[N] = {};
int main() {
  f[0] = 1;
  for (int i = 1; i < N; ++i) f[i] = (f[i - 1] * i) % mod;
  inv_f[N - 1] = mod_inv(f[N - 1]);
  for (int i = N - 2; i >= 0; --i) inv_f[i] = (inv_f[i + 1] * (i + 1)) % mod;
  int n;
  scanf(" %d", &n);
  vector<int> a(n);
  for (int(i) = 0; (i) < (int)(n); ++(i)) scanf(" %d", &a[i]);
  sort((a).begin(), (a).end());
  vector<int> v(a);
  v.erase(unique((v).begin(), (v).end()), v.end());
  vector<int> idx(n);
  for (int(i) = 0; (i) < (int)(n); ++(i)) {
    idx[i] = lower_bound((v).begin(), (v).end(), a[i]) - v.begin();
    ++s[idx[i]];
  }
  for (int i = N - 2; i >= 0; --i) s[i] += s[i + 1];
  ll ans = 0;
  for (int(i) = 0; (i) < (int)(n); ++(i))
    if (a[i] != a[n - 1]) {
      ll m = f[s[idx[i]] - 1];
      (m *= f[n - s[idx[i]]]) %= mod;
      (m *= C(n, s[idx[i]])) %= mod;
      (ans += m * a[i]) %= mod;
    }
  printf("%lld\n", ans);
  return 0;
}
