func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MX = 100000;   const int N = 1e5 + 5;   const int K = 135;   const int MOD = 1e9 + 7;   int n, first[N], incr[N], x[K];   long long pw[K][N];   int main() {     cin >> n;     for (int i = 0; i < n; ++i) {       int x;       scanf( %d , &x);       incr[x]++;     }     for (int i = 1; i < K; ++i) pw[i][0] = 1;     for (int i = 0; i < N; ++i) pw[0][i] = 1;     for (int j = 1; j < N; ++j)       for (int i = 0; i < K; ++i) pw[i][j] = pw[i][j - 1] * i % MOD;     for (int i = MX; i >= 1; --i) first[i] = first[i + 1] + incr[i];     long long ans = 0;     for (int i = MX; i >= 1; --i)       if (first[i]) {         vector<int> d1, d2, d;         int dd = 1;         for (; dd * dd < i; ++dd)           if (i % dd == 0) {             d1.push_back(dd);             d2.push_back(i / dd);           }         if (dd * dd == i) d1.push_back(dd);         reverse(d2.begin(), d2.end());         merge(d1.begin(), d1.end(), d2.begin(), d2.end(), back_inserter(d));         int prev = 0;         long long p1 = 1, p2 = 1;         for (int j = (int)d.size() - 1; j >= 0; --j) {           x[j + 1] = first[d[j]] - prev;           prev += x[j + 1];           p1 = p1 * pw[j + 1][x[j + 1]] % MOD;           if (j + 1 == d.size())             p2 = p2 * pw[j][x[j + 1]] % MOD;           else             p2 = p2 * pw[j + 1][x[j + 1]] % MOD;         }         ans += p1 - p2;         ans %= MOD;         if (ans < 0) ans += MOD;       }     cout << ans;     return 0;   }   