#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
int main() {
  long long n;
  cin >> n;
  long long k[61];
  for (int i = 0; i < (int)(61); i++) k[i] = 0;
  long long one = 1;
  for (int i = 0; i < (int)(n); i++) {
    long long a;
    cin >> a;
    for (int j = 0; j < (int)(61); j++)
      if (a & (one << j)) k[j]++;
  }
  long long sum = 0;
  for (int i = 0; i < (int)(61); i++) {
    sum += (k[i] * (n - k[i]) * (one << i));
    sum %= 1000000007;
  }
  cout << sum << endl;
  return 0;
}
