#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template <class T>
using V = vector<T>;
using Graph = vector<vector<int>>;
using P = pair<long long, long long>;
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;
}
const long long INF = 1e18;
long long f(long long n) {
  long long m = 1;
  for (int i = 0; i < n; i++) m *= 2;
  return m;
}
signed main() {
  long long n;
  cin >> n;
  V<long long> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  ;
  long long ans = 0;
  for (long long i = 0; i < 60; i++) {
    long long cnt = 0;
    for (long long j = 0; j < n; j++) {
      if (a[j] >> i & 1) cnt++;
    }
    ans += ((cnt * (n - cnt)) * f(i)) % 1000000007;
    ans = ans % 1000000007;
  }
  cout << ans << endl;
}
