#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll mod_pow(ll a, ll b, ll m) {
  ll res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a) % m;
    }
    a = (a * a) % m;
    b >>= 1;
  }
  return res;
}
ll mod_inverse(ll a) { return mod_pow(a, 1000000007 - 2, 1000000007); }
void solve() {
  long long int n;
  cin >> n;
  long long int bit[64]{};
  for (long long int i = 0; i < n; ++i) {
    long long int x;
    cin >> x;
    for (long long int i = 0; i < 60; ++i) {
      if (((1LL << i) & x)) {
        bit[i]++;
      }
    }
  }
  long long int ans = 0;
  for (long long int i = 0; i < 60; ++i) {
    ans = (ans + ((1LL << i) * (((n - bit[i]) * bit[i]) % 1000000007))) %
          1000000007;
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
