#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, dp[1000005], a, sum[1000005], pos[1000005], ans, sz[1000005];
void Add(long long &x) { x = (x % mod + mod) % mod; }
int main() {
  cin >> n;
  pos[0] = 1;
  for (int i = 1; i <= 1000000; i++) pos[i] = pos[i - 1] * 2 % mod;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a);
    int sq = sqrt(a);
    for (int j = 1; j <= sq; j++)
      if (a % j == 0) {
        sum[j]++;
        if (j * j != a) sum[a / j]++;
      }
  }
  for (int i = 1000000; i > 1; i--) {
    if (sum[i] == 0) continue;
    int sq = sqrt(i);
    ans += (((pos[sum[i] - 1] * sum[i]) % mod) - sz[i]) * i;
    Add(ans);
    for (int j = 2; j <= sq; j++)
      if (i % j == 0) {
        sz[j] += pos[sum[i] - 1] * sum[i] - sz[i];
        Add(sz[j]);
        if (j * j != i) {
          sz[i / j] += pos[sum[i] - 1] * sum[i] - sz[i];
          Add(sz[i / j]);
        }
      }
  }
  cout << ans;
}
