#include <bits/stdc++.h>
using namespace std;
long long arr[300005];
long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long sum = 0;
  for (long long i = 0; i < 60; i++) {
    long long req = 0;
    long long ev = 0;
    long long od = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        ev++;
      else
        od++;
      arr[j] = arr[j] / 2;
    }
    req = (od % mod * ev % mod) % mod;
    req = ((req % mod) * (1LL << i) % mod) % mod;
    sum = sum % mod + req % mod;
    sum %= mod;
  }
  cout << sum << endl;
  return 0;
}
