#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
void md(int &a) {
  while (a >= mod) a -= mod;
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (auto &i : a) cin >> i;
  vector<int> cnt(60);
  for (int j = 0; j < n; ++j) {
    for (int bit = 0; bit < 60; ++bit) {
      if ((1ll << bit) & a[j]) cnt[bit]++;
    }
  }
  int answer = 0;
  for (int j = 0; j < 60; ++j) {
    answer += 1ll * (1ll << j) * (cnt[j]) % mod * (n - cnt[j]) % mod;
    md(answer);
  }
  cout << answer;
  return 0;
}
