#include <bits/stdc++.h>
using namespace std;
int main() {
  long long trudy = 1000000007;
  long long n;
  cin >> n;
  long long zero[61], ichi[61];
  for (int i = 0; i <= 60; i++) {
    zero[i] = 0;
    ichi[i] = 0;
  }
  for (long long i = 0; i < n; i++) {
    long long num;
    cin >> num;
    for (long long j = 0; j <= 60; j++) {
      if (num & ((long long)1 << j))
        ichi[j]++;
      else
        zero[j]++;
    }
  }
  long long sum = 0;
  for (long long i = 0; i <= 60; i++) {
    long long temp = zero[i] * ichi[i];
    temp %= trudy;
    temp *= ((long long)1 << i);
    temp %= trudy;
    sum += temp;
    sum %= trudy;
  }
  cout << sum << endl;
  return 0;
}
