#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> array(n);
  for (int i = 0; i < n; ++i) {
    cin >> array.at(i);
  }
  sort(array.begin(), array.end());
  long double sum = 0;
  long double val = 1;
  long double res = 0;
  do {
    for (int i = 0; i < n - 1; i++) {
      sum += abs(array.at(i) - array.at(i + 1));
      val /= (n - 1 - i);
    }
    res += sum * val;
    sum = 0;
    val = 1;
  } while (next_permutation(array.begin() + 1, array.end()));
  long long k = 1;
  for (int i = 1; i < n; ++i) {
    k *= i;
  }
  cout << fmod(res * k, 1e9 + 7) << endl;
  return 0;
}
