#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long N;
  cin >> N;
  vector<unsigned long long> A(N, 0);
  for (unsigned long long(i) = (0); (i) < (N); (i)++) {
    cin >> A[i];
  }
  unsigned long long sum = 0;
  for (unsigned long long(i) = (0); (i) < (60); (i)++) {
    unsigned long long b = 0;
    for (unsigned long long(j) = (0); (j) < (N); (j)++) {
      b += (A[j] >> i & 1ULL);
    }
    sum += b % 1000000007ULL * (N - b) % 1000000007ULL * (1ULL << i) %
           1000000007ULL;
  }
  cout << sum % 1000000007ULL << endl;
  return 0;
}
