func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, x, ans, kiri, kanan, sum, i, pos;   long long a[300007], dua[300007];   int main() {     scanf( %lld , &n);     dua[0] = 1;     for (i = 1; i <= 300000; i++) dua[i] = (dua[i - 1] * 2) % 1000000007;     x = 1;     scanf( %lld , &a[0]);     pos = -1;     for (i = 1; i < n; i++) {       scanf( %lld , &a[i]);       sum = (sum + x) % 1000000007;       x = (x * 2) % 1000000007;       pos++;     }     sort(a, a + n);     kiri = 0;     kanan = n - 1;     x = 1;     while (kiri <= kanan) {       ans = (ans + sum * (a[kanan] - a[kiri])) % 1000000007;       kiri++;       kanan--;       sum = ((sum - x) % 1000000007 + 1000000007) % 1000000007;       sum = ((sum - dua[pos]) % 1000000007 + 1000000007) % 1000000007;       pos--;       x = (x * 2) % 1000000007;     }     printf( %lld n , ans);   }   