#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int k[63] = {};
  for (int i = 0; i < (N); ++i) {
    long long int A;
    cin >> A;
    for (int i = 0; A != 0; ++i) {
      if ((A & 1) != 0) {
        k[i]++;
      }
      A = A >> 1;
    }
  }
  long long int ret = 0;
  for (int i = 0; i < (63); ++i) {
    long long int m = (1LL << i) % 1000000007;
    long long int c = k[i] * (N - k[i]) % 1000000007;
    ret += m * c;
    ret = ret % 1000000007;
  }
  cout << ret << endl;
}
