#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const int INF = 1001001001;
const long long INFL = (1LL << 60);
const double eps = (1e-9);
long long mod = 1000000007;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> one(63, 0);
  vector<long long> zero(63, 0);
  for (int i = 0; i < (n); ++i) {
    long long a;
    cin >> a;
    for (int j = 0; j < 63; j++) {
      if ((a >> j) & 1) {
        one[j]++;
      } else {
        zero[j]++;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < one.size(); i++) {
    long long base = pow(long long(2), i);
    long long x = (one[i] * zero[i]) % mod;
    ans += (x * base) % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
