#include <bits/stdc++.h>
using namespace std;
string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const bool b) { return (b ? "true" : "false"); }
string to_string(const char* s) { return to_string((string)s); }
string to_string(const char c) {
  string s = "'";
  s += c;
  s += "'";
  return s;
}
template <class T, class U>
string to_string(const pair<T, U>& p) {
  string s = "(";
  s += to_string(p.first);
  s += ", ";
  s += to_string(p.second);
  s += ")";
  return s;
}
template <class T>
string to_string(const T& a) {
  bool first = true;
  string s = "{";
  for (const auto& x : a) {
    if (!first) {
      s += ", ";
    }
    first = false;
    s += to_string(x);
  }
  s += "}";
  return s;
}
void debug_out() { cerr << '\n'; }
template <class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
  cerr << ' ' << to_string(head);
  debug_out(tail...);
}
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 2e9;
const ll inf64 = 7e18l;
int mult(int x, int y) { return 1ll * x * y % mod; }
int add(int x, int y) {
  x += y;
  if (x >= mod) {
    return x - mod;
  }
  return x;
}
int sub(int x, int y) {
  x -= y;
  if (x < 0) {
    return x + mod;
  }
  return x;
}
void sub_self(int& x, int y) { x = sub(x, y); }
void add_self(int& x, int y) { x = add(x, y); }
int bin_pow(int x, int y) {
  if (y == 0) {
    return 1;
  }
  if (y % 2 == 0) {
    return bin_pow(mult(x, x), y / 2);
  }
  return mult(x, bin_pow(x, y - 1));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<int> cnt(1e6 + 1);
  for (int i = 0; i < n; ++i) {
    for (int j = 1; j * j <= a[i]; ++j) {
      if (a[i] % j == 0) {
        ++cnt[j];
        if (j != a[i] / j) {
          ++cnt[a[i] / j];
        }
      }
    }
  }
  int answer = 0;
  int mx = 1e6;
  vector<int> dp(1e6 + 1);
  for (int i = mx; i >= 2; --i) {
    if (cnt[i] == 0) {
      continue;
    }
    add_self(dp[i], mult(cnt[i], bin_pow(2, cnt[i] - 1)));
    for (int k = 2 * i; k <= mx; k += i) {
      sub_self(dp[i], dp[k]);
    }
    add_self(answer, mult(dp[i], i));
  }
  cout << answer << '\n';
  return 0;
}
