#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int k;
    cin >> k;
    int ans = 0;
    for (ll a = 1; a <= k; a++) {
        for (ll b = 1; a * b <= k; b++){
            for (ll c = 1; a * b * c <= k; c++){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N;
  cin >> N;
  vector<int64_t> A(N);
  rep(i, N) cin >> A.at(i);
  sort(A.begin(), A.end());
  int64_t ans = 0, min;
  rep(i, N) {
    if (i == 0) {
      min = A.at(i);
    } else {
      ans += (A.at(i) - min) * (i - (N - i - 1));
    }
  }
  cout << ans << endl;
}