#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
ll mod = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ull> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> bit(60, 0);
  for (int i = 0; i < n; i++) {
    int j = 0;
    while (j < 60) {
      if (a[i] & ((ull)1 << j)) bit[j]++;
      j++;
    }
  }
  ull ans = 0;
  for (int i = 0; i < 60; i++) {
    ans += (ull)pow(2, i) * bit[i] * (n - bit[i]);
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
