#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long one[60], zero[60];
  for (auto k = 0; k < 60; ++k) {
    one[k] = 0;
    zero[k] = 0;
  }
  for (auto i = 0; i < N; ++i) {
    long long A;
    cin >> A;
    long long hoge = 1;
    for (auto k = 0; k < 60; ++k) {
      if (A % 2 == 0) {
        zero[k]++;
      } else {
        one[k]++;
      }
      A = A / 2;
      hoge = hoge * 2;
    }
  }
  long long sum = 0;
  long long max = 10e9 + 7;
  long long a = 1;
  for (long long i = 0; i < 60; i++) {
    long long b = zero[i] * one[i];
    long long c = (a * b) % max;
    sum += c;
    sum %= max;
    a = (a * 2) % max;
  }
  cout << sum % max << endl;
  return 0;
}
