#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  for (int i = 0; i < ((int)v.size()); ++i) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}
template <typename T, size_t S>
void printArray(const T (&array)[S]) {
  for (auto val : array) std::cout << val << ", ";
  std::cout << "\n";
}
const int mod = 1e9 + 7;
const int inf = 1e9 + 5;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  std::cin >> n;
  vector<ll> a(n);
  ll ma = 0;
  for (int i = 0; i < (n); ++i) {
    std::cin >> a[i];
    (ma = max(ma, a[i]));
  }
  ll ans = 0;
  for (int i = 0; i < (60); ++i) {
    ll cnt = 0;
    for (int j = 0; j < (n); ++j) cnt += (a[j] >> i) & 1;
    ans = (ans + cnt * (n - cnt) * ((1ll << i) % mod)) % mod;
  }
  std::cout << ans << "\n";
}
