#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<long int> vec(n);
  vector<int> bit_vec(60);
  long int one = 1;
  for (int i = 0; i < n; i++) {
    scanf("%ld", &vec[i]);
    for (int j = 0; j < 60; j++) {
      if (one << j & vec[i]) {
        bit_vec[j]++;
      }
    }
  }
  long int div = 1000000007;
  long int ans = 0;
  for (int i = 0; i < 60; i++) {
    ans += (bit_vec[i] * (n - bit_vec[i]) % div) * ((one << i) % div) % div;
    ans = ans % div;
  }
  printf("%ld", ans);
}
