#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate {
  ios_accelerate() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
  }
} CALL;
using LL = long long;
using UL = unsigned;
using ULL = unsigned long long;
template <typename T>
using V = vector<T>;
template <typename T>
using VV = vector<vector<T>>;
template <typename T>
using P = pair<T, T>;
const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;
template <typename T>
inline void upsort(vector<T>& x) {
  sort(x.begin(), x.end());
}
template <typename T>
inline void downsort(vector<T>& x) {
  sort(x.begin(), x.end(), greater<T>());
}
template <typename T>
inline void col(T x) {
  cout << x << '\n';
}
template <>
inline void col(double x) {
  cout << fixed << setprecision(12) << x << '\n';
}
signed main() {
  ULL n;
  cin >> n;
  V<ULL> a(n);
  for (auto&(ai) : (a)) {
    cin >> ai;
  }
  V<ULL> zeros(60, 0), ones(60, 0);
  for (auto&(ai) : (a)) {
    bitset<60> bit(ai);
    for (auto(j) = (60) * 0; (j) < (60); (j)++) {
      if (bit[j]) {
        ones[j]++;
      } else {
        zeros[j]++;
      }
    }
  }
  ULL ans = 0, k = 1;
  for (auto(i) = (60) * 0; (i) < (60); (i)++) {
    ans += zeros[i] * ones[i] * k;
    ans %= MOD;
    k *= 2;
  }
  col(ans);
  return 0;
}
