#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> v(n, 0);
  for (long long i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  vector<long long> co(n, 1);
  for (long long i = n - 1; i >= 2; i--) {
    co[0] = (co[0] * i) % 1000000007;
    co[0] %= 1000000007;
  }
  for (long long i = 1; i < n - 1; i++) {
    co[i] = co[i - 1] + co[0] / (i + 1);
    co[i] %= 1000000007;
    co[i] += 1000000007;
    co[i] %= 1000000007;
  }
  long long ans = 0;
  for (long long i = 0; i < n - 1; i++) {
    ans += (co[i] * (v[i + 1] - v[i])) % 1000000007;
    ans %= 1000000007;
    ans += 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
