#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;
int main() {
source:
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (ll i = (0); i < (n); i++) {
    cin >> a[i];
  }
  ul ans = 0;
  ul base = 1;
  for (ll num = (0); num < (60); num++) {
    ll zero = 0, one = 0;
    for (ll i = (0); i < (n); i++) {
      if (a[i] & (1LL << num)) {
        one++;
      } else {
        zero++;
      }
    }
    ans += zero * one * base;
    ans %= mod;
    base = (base * 2) % mod;
  }
  ans %= mod;
  cout << ans << endl;
  return 0;
}
