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