#include <bits/stdc++.h>
using namespace std;

int main() {
  long N, A, m, b = 0, c = 0;
  cin >> N;
  m = N;

  while (m) {
    m--;
    cin >> A;
    b += A;
    c += A * A;
  }

  cout << N * c - b * b << endl;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define len(a) (int)a.size()
#define all(a) a.begin(), a.end()

const int INF32 = 1 << 30;
const long long INF64 = 1LL << 60;
const double PI = acos(-1);

int main() {
    string N;
    cin >> N;

    int n = len(N);
    int p = 2;
    ll ans = 0;
    while (1) {
        if (p > n) {
            break;
        }
        else if (p < n) {
            ans += pow(10, p / 2) - pow(10, p / 2 - 1);
        }
        else {
            ll i1 = stoll(N.substr(0, p / 2));
            ll i2 = stoll(N.substr(p / 2));
            ll i0 = pow(10, p / 2 - 1);
            ans += i1 - i0;
            if (i2 >= i1) ans++;
        }
        p += 2;
    }
    cout << ans << endl;
    
}
