#include <bits/stdc++.h>
using namespace std;
const int iinf = 0x3f3f3f3f;
const long long linf = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
void fmod(int& first) { first += first >> 31 & mod; }
const int N = 1e6, bN = 6, sN = 1e6;
int n, cnt[sN], sm[sN], sm2[sN], pw2[N + 1];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> n;
  pw2[0] = 1;
  for (int i = (0), iE = (n); i < iE; i++)
    fmod(pw2[i + 1] = (pw2[i] << 1) - mod);
  for (int i = (0), iE = (n); i < iE; i++) {
    int s;
    cin >> s;
    fmod(sm2[s] += sm2[s] - mod);
    fmod(sm2[s] += 1ll * s * s % mod * pw2[cnt[s]] % mod - mod);
    fmod(sm2[s] += 2ll * sm[s] % mod * s % mod - mod);
    fmod(sm[s] += sm[s] - mod),
        fmod(sm[s] += 1ll * pw2[cnt[s]] * s % mod - mod);
    cnt[s]++;
  }
  for (int mid = 1; mid < sN; mid *= 10)
    for (int i = 0; i < sN; i += mid * 10)
      for (int j = (i), jE = (i + mid); j < jE; j++)
        for (int k = (9) - 1, kE = (0) - 1; k > kE; k--) {
          int first = j + mid * k, second = first + mid;
          fmod((sm2[first] = 1ll * sm2[first] * pw2[cnt[second]] % mod) +=
               1ll * sm2[second] * pw2[cnt[first]] % mod - mod);
          fmod(sm2[first] += 2ll * sm[first] * sm[second] % mod - mod);
          fmod((sm[first] = 1ll * sm[first] * pw2[cnt[second]] % mod) +=
               1ll * sm[second] * pw2[cnt[first]] % mod - mod);
          fmod(cnt[j + mid * k] += cnt[j + mid * (k + 1)] - mod);
        }
  for (int mid = 1; mid < sN; mid *= 10)
    for (int i = 0; i < sN; i += mid * 10)
      for (int j = (i), jE = (i + mid); j < jE; j++)
        for (int k = (0), kE = (9); k < kE; k++)
          fmod(sm2[j + mid * k] -= sm2[j + mid * (k + 1)]);
  long long ans = 0;
  for (int i = (0), iE = (sN); i < iE; i++) ans ^= 1ll * i * sm2[i];
  cout << ans << '\n';
  return 0;
}
