#include <bits/stdc++.h>
using namespace std;
long int pow2(int a) {
  long int s = 1;
  for (int i = 0; i < (a); i++) {
    (s *= 2) %= 1000000007;
  }
  return s;
}
int main() {
  map<int, long int> mp;
  int n;
  cin >> n;
  for (int i = 0; i < (n); i++) {
    long int a;
    cin >> a;
    int k = 0;
    while (a) {
      if (a % 2) mp[k]++;
      a /= 2;
      k++;
    }
  }
  long int s = 0;
  for (auto x : mp) {
    if (1) printf("[%d %d]", x.first, x.second);
    long int temp = x.second * (n - x.second) % 1000000007;
    (s += pow2(x.first) * temp % 1000000007) %= 1000000007;
  }
  printf("%ld", s);
}
