#include <bits/stdc++.h>
using namespace std;
const int MX = 1e6 + 5;
const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
int pwr[N];
int cnt[MX];
int n;
void precompute() {
  pwr[0] = 1;
  for (int i = 1; i < N; i++) {
    pwr[i] = (pwr[i - 1] << 1) % MOD;
  }
}
void read() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
}
int solve() {
  for (int i = 1; i < MX; i++)
    for (int j = i + i; j < MX; j += i) cnt[i] += cnt[j];
  int ret = 0;
  for (int i = MX - 1; i >= 2; i--)
    if (cnt[i] > 0) {
      long long ways = 1ll * cnt[i] * pwr[cnt[i] - 1] % MOD;
      for (int j = i + i; j < MX; j += i) {
        ways = (ways - cnt[j] + MOD) % MOD;
      }
      ret = (ret + ways * i) % MOD;
      cnt[i] = ways;
    }
  return ret;
}
int main() {
  precompute();
  read();
  cout << solve() << endl;
  return 0;
}
