func_code_string: #include <bits/stdc++.h>   using namespace std;   long long mod = 1e9 + 7;   long long rev2 = (mod + 1) / 2;   long long mas[300300];   long long pow2[300300];   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %lld , &mas[i]);     sort(mas, mas + n);     pow2[0] = 1;     for (int i = 1; i < 300300; i++) pow2[i] = (pow2[i - 1] * 2LL) % mod;     for (int i = 1; i < n; i++) {       mas[i] -= mas[0];     }     mas[0] = 0;     long long sum = 0;     long long mn = 1;     for (int i = 1; i < n; i++) {       sum += mas[i] * mn;       sum %= mod;       mn *= 2;       mn %= mod;     }     long long res = 0;     for (int i = 1; i < n; i++) {       res += sum;       res %= mod;       sum -= (mas[i] - mas[i - 1]);       sum %= mod;       if (sum < 0) sum += mod;       sum *= rev2;       sum %= mod;       sum -= (long long)(pow2[n - i - 1] - 1) * (mas[i] - mas[i - 1]);       sum %= mod;       if (sum < 0) sum += mod;     }     printf( %lld , res);     return 0;   }   