#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const int MOD = 1000000007;
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 (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  map<ll, int> mp;
  for (int bit = 0; bit < (61); bit++) {
    ll num = 1ll << bit;
    int cnt = 0;
    for (int i = 0; i < (n); i++) {
      if (1ll << bit & a[i]) cnt++;
    }
    mp[num % MOD] = cnt;
  }
  ll ans = 0;
  for (const auto &m : mp) {
    if (m.second) {
      ;
      ans += (m.first % MOD) * m.second * (n - m.second);
      ans %= MOD;
    }
  }
  cout << ans % MOD << endl;
}
