#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int P = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  constexpr int K = 7, L = K * 3, T = (1 << K) - 1;
  constexpr ll S = T | (ll)T << L | (ll)T << (L * 2),
               X = ((1ULL << (L * 3)) - 1) / T;
  int p0[L] = {};
  ll r = 0;
  for (int i0 = 0; i0 < n; i0 += T) {
    ll p[K] = {};
    int i1 = min(T, n - i0);
    for (int i = 0; i < i1; i++) {
      ll a;
      cin >> a;
      for (int k = 0; k < K; k++) {
        p[k] += a & X;
        a >>= 1;
      }
    }
    for (int k = 0; k < K; k++) {
      ll c = p[k];
      for (int h = 0; h < 3; h++) {
        p0[K * h + k] += c & S;
        c >>= K;
      }
    }
  }
  for (int k = 0; k < L; k++) {
    ll c = p0[k];
    for (int h = 0; h < 3; h++) {
      ll t = c & ((1LL << L) - 1);
      c >>= L;
      r += (1LL << (L * h + k)) % P * t % P * (n - t) % P;
    }
  }
  r %= P;
  cout << r << endl;
  return 0;
}
