// author: gary
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ( (int) (x).size() )
#define DBG(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)
typedef pair<int, int> pii;
typedef long long ll;
template<class T> bool cmax(T& a, T b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool cmin(T& a, T b) { if(a > b) { a = b; return true; } return false; }


ll solve(ll x) {
  ll ans = x;
  for(ll i = 2; i * i <= x; i++){
    if(x % i == 0) {
      while(x % i == 0) {
        x /= i;
        ans += x;
      }
    }
  }
  if(x > 1) {
    ans ++;
  }
  return ans;
}

int main() {
  int n;
  ll ans = 0;
  scanf("%d", &n);
  for(int i = 0; i < n; i++) {
    ll x;
    scanf("%lld", &x);
    ans += solve(x);
    // DBG(solve(x));
  }
  printf("%lld\n", ans);
  return 0;
}