#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = (1e9) + 7;
int main() {
  int n;
  cin >> n;
  vector<int> num(60);
  for (int i = 0; i < n; i++) {
    ll s;
    cin >> s;
    bitset<60> b(s);
    for (int bit = 0; bit < 60; bit++) {
      if (b[bit]) {
        num[bit]++;
      }
    }
  }
  ll ans = 0;
  ll x = 1;
  for (int bit = 0; bit < 60; bit++) {
    ans += x * (ll)num[bit] * (ll)(n - num[bit]);
    ans %= mod;
    x *= 2;
    x %= mod;
  }
  cout << ans << endl;
  return 0;
}
