#include <bits/stdc++.h>
const long long INF = 1e9 + 1;
const double EPS = 1e-10;
const long long P = 1e9 + 7;
const long long Q = 31;
using namespace std;
void hello() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void show(vector<long long>& arr) {
  for (auto i : arr) cout << i << " ";
  cout << "\n";
}
void show(vector<vector<long long>>& arr) {
  for (auto i : arr) show(i);
  cout << "\n";
}
signed main() {
  hello();
  long long n;
  cin >> n;
  vector<long long> seq(n);
  for (long long i = 0; i < n; ++i) cin >> seq[i];
  vector<long long> cnt(60);
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < 60; ++j)
      if (seq[i] & (1ll << j)) ++cnt[j];
  }
  long long res = 0;
  for (long long i = 0; i < 60; ++i) {
    res += (cnt[i] * (n - cnt[i])) % P * (1ll << i);
    res %= P;
  }
  cout << res << "\n";
}
