#include <bits/stdc++.h>   using namespace std;   long long gcd(long long n1, long long n2) {     if (!n1) return n2;     if (!n2) return n1;     if (n1 % n2 == 0) return n2;     return gcd(n2, n1 % n2);   }   long long powmod(long long base, long long exponent) {     base %= 1000000007;     long long ans = 1;     while (exponent) {       if (exponent & 1) ans = (ans * base) % 1000000007;       base = (base * base) % 1000000007;       exponent /= 2;     }     ans %= 1000000007;     return ans;   }   int arr[1000100 + 1];   int cnt[1000100 + 1];   int pw[1000100 + 1];   int dp[1000100 + 1];   int main() {     int n, i, j, k;     pw[0] = 1;     for (i = 1; i <= 1000100; i++) {       pw[i] = (2 * pw[i - 1]) % 1000000007;     }     scanf( %d , &n);     for (i = 1; i <= n; i++) {       scanf( %d , &arr[i]);       cnt[arr[i]]++;     }     for (i = 1; i <= 1000100; i++)       for (j = i; j <= 1000100; j += i) dp[i] += cnt[j];     for (i = 1; i <= 1000100; i++)       if (dp[i]) {         dp[i] = (1LL * dp[i] * pw[dp[i] - 1]) % 1000000007;       }     long long answer = 0;     for (i = 1000100; i >= 2; i--) {       for (j = 2 * i; j <= 1000100; j += i) {         dp[i] -= dp[j];         if (dp[i] < 0) dp[i] += 1000000007;       }       answer = (answer + 1LL * i * dp[i]) % 1000000007;     }     printf( %lld n , answer);     return 0;   }   