#include <bits/stdc++.h>
using namespace std;
const int N = pow(10, 9) + 7;
long int pow2(long int n) {
  long int ans = 1;
  for (long int i = 0; i < n; ++i) {
    ans = (ans * 2) % N;
  }
  return ans;
}
int main() {
  long int n;
  cin >> n;
  vector<long int> a(n);
  for (long int i = 0; i < n; ++i) cin >> a[i];
  long int ans = 0;
  for (long int i = 0; i <= 60; ++i) {
    long int count1 = 0;
    for (long int j = 0; j < n; ++j)
      if (a[j] >> i & 1) count1++;
    long int count0 = n - count1;
    long int comb = (count0 % N) * (count1 % N);
    ans += pow2(i) * comb % N;
    ans %= N;
  }
  cout << ans << endl;
  return 0;
}
