#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (long long)(n); ++i) cin >> a[i];
  long long ans = 0;
  const long long mod = 1000000007;
  long long two = 1;
  for (int digit = 0; digit <= 60; digit++) {
    long long sum = 0;
    for (long long i = 0; i < (long long)(n); ++i) {
      if (a[i] & (1LL << digit)) sum++;
    }
    sum = sum * (n - sum);
    sum = (sum * two) % mod;
    ans = (ans + sum) % mod;
    two = (two * 2) % mod;
  }
  ans %= mod;
  cout << ans << endl;
  return 0;
}
