#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int a;
  vector<long long int> vec(60);
  for (int i = 0; i < n; i++) {
    cin >> a;
    bitset<60> bit(a);
    for (int j = 0; j < 60; j++) {
      if (bit.test(j)) {
        vec.at(j)++;
      }
    }
  }
  long long int mod = 1000000007;
  long long int answer = 0, p = 1;
  for (int i = 0; i < 60; i++) {
    for (int j = 0; j < i; j++) {
      p *= 2;
      p %= mod;
    }
    answer += p * vec.at(i) * (n - vec.at(i)) % mod;
    answer %= mod;
    p = 1;
  }
  cout << answer % mod << endl;
}
