#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 ll T = 1LL << 10, X = ((((T + 1) * T + 1) * T + 1) * T + 1) * T + 1;
  ll p[10] = {};
  ll r = 0;
  for (int i0 = 0; i0 < n; i0 += (1 << 10) - 1) {
    for (int i = i0; i < min(i0 + (1 << 10) - 1, n); i++) {
      ll a;
      cin >> a;
      for (int k = 0; k < 10; k++) {
        p[k] += a & X;
        a >>= 1;
      }
    }
    for (int k = 0; k < 10; k++) {
      ll c = p[k];
      for (int h = 0; h < 6; h++) {
        ll t = c & T - 1;
        c /= T;
        r += (1LL << (10 * h + k)) % P * t % P * (n - t) % P;
      }
    }
    r %= P;
  }
  cout << r << endl;
  return 0;
}
