#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long n, a[200008], maxi, num[1000008], tmp, p2[200008], ans, dp[1000008];
int main() {
  cin >> n;
  p2[0] = 1;
  for (int i = 1; i <= n; i++) p2[i] = 2 * p2[i - 1] % MOD;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    maxi = max(maxi, a[i]);
    num[a[i]]++;
  }
  for (int i = maxi; i > 1; i--) {
    tmp = 0;
    for (int j = i; j <= maxi; j += i) tmp += num[j];
    if (tmp) {
      dp[i] = tmp * p2[tmp - 1] % MOD;
      for (int j = i + i; j <= maxi; j += i)
        dp[i] = (dp[i] - dp[j] + MOD) % MOD;
      ans = (ans + dp[i] * i) % MOD;
    }
  }
  cout << ans;
  return 0;
}
