#include using namespace std; using ll = long long; #define rep(i,m,n) for(int i=m; i> N; vector A(N); for(ll &a : A) cin >> a; vector cnt(10, 0); rep(i, 0, N){ cnt[A[i]]++; } ll ans = 0LL; rep(i, 1, 9){ rep(j, 1, 9){ repl(k, 0, cnt[i]*cnt[j]){ ans += powered[i][j]; } } } cout << ans << endl; return 0; }