#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long modinv(long long a, long long mod) { return modpow(a, mod - 2, mod); }
const long long MOD = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<long long> cnt_base(60);
  for (long long i = 0; i < 60; i++) {
    cnt_base[i] = 0;
  }
  for (long long i = 0; i < 60; i++) {
    long long base = (1LL << i);
    for (long long j = 0; j < N; j++) {
      if (A[j] & (1LL << i)) {
        cnt_base[i]++;
      }
    }
  }
  long long tmp_ans = 0;
  for (int i = 0; i < N; i++) {
    long long base = 1;
    for (int j = 0; j < 60; j++) {
      if (A[i] & (1LL << j)) {
        tmp_ans = (tmp_ans + base * (N - cnt_base[j])) % MOD;
      } else {
        tmp_ans = (tmp_ans + base * cnt_base[j]) % MOD;
      }
      base = base * 2;
    }
  }
  long long ans = (tmp_ans * modinv(2, MOD)) % MOD;
  cout << ans << endl;
  return 0;
}
