#include <bits/stdc++.h>
using namespace std;
const int MX = 1e6;
const int inf = 1e9;
const int mod = 1e9 + 7;
using P = pair<int, int>;
vector<int> to[100005];
int cost[100005];
signed main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = (0); i < (n); ++i) cin >> a[i];
  long long ans = 0;
  for (int i = (0); i < (60); ++i) {
    long long x = 0;
    for (int j = (0); j < (n); ++j) {
      if (a[j] >> i & 1) ++x;
    }
    long long tmp = x * (n - x) % mod;
    for (int j = (0); j < (i); ++j) tmp *= 2 % mod;
    tmp %= mod;
    ans += tmp;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
