func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mod = (int)1e9 + 7, maxn = (int)1e5 + 5;   int a[maxn], d[maxn];   int mpow(int A, int N) {     int ret = 1;     while (N) {       if (N & 1) ret = (ret * 1ll * A) % mod;       A = (A * 1ll * A) % mod;       N >>= 1;     }     return ret;   }   int main() {     ios_base::sync_with_stdio(0);     cin.clear();     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     sort(a, a + n);     int ans = 0;     for (int i = maxn - 1; i > 0; i--) {       int sz = 0;       for (int j = 1; j * j <= i; j++) {         if (i % j) continue;         if (j != i) d[sz++] = j;         if (j != 1 && j * j != i) d[sz++] = i / j;       }       sort(d, d + sz);       int lim = lower_bound(a, a + n, i) - a;       int cur = (mpow(sz + 1, n - lim) - mpow(sz, n - lim) + mod) % mod;       for (int j = sz - 1; j >= 0; j--) {         int idx = lower_bound(a, a + lim, d[j]) - a;         cur = (cur * 1ll * mpow(j + 1, lim - idx)) % mod;         lim = idx;       }       ans = (ans + cur) % mod;     }     cout << ans;   }   