#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> cnt(100, 0);
  for (int i = 0; i < n; i++) {
    for (int bit = 0; bit < 60; bit++) {
      if (a[i] & (1LL << bit)) cnt[bit]++;
    }
  }
  ull ans = 0;
  ull t = 0;
  ull x = 0;
  for (int bit = 0; bit < 60; bit++) {
    t = pow(2, bit);
    t %= mod;
    x = cnt[bit] * (n - cnt[bit]);
    x %= mod;
    ans += t * x;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
