#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N;
  cin >> N;
  vector<long long int> A(3e5 + 10);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long int MOD = 1e9 + 7;
  long long int ans = 0;
  long long int sum;
  long long int t = 1;
  int count = 0;
  while (count < 60) {
    sum = 0;
    for (int i = 0; i < N; i++) {
      if (A[i] & t) sum++;
    }
    long long int tmp;
    tmp = t % MOD;
    tmp = (tmp * sum) % MOD;
    ans += (tmp * (N - sum)) % MOD;
    count++;
    t *= 2;
  }
  cout << ans << endl;
  return 0;
}
