#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> v;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    v.push_back(temp);
  }
  long long ans = 0;
  int mod = (int)(1e9 + 7);
  long long ma = *max_element(v.begin(), v.end());
  int siz = 0;
  vector<long long> pow(61);
  pow[0] = 1;
  for (int i = 1; i < 61; i++) {
    pow[i] = ((pow[i - 1] % mod) * (2 % mod)) % mod;
  }
  while (ma >= 1) {
    siz++;
    ma = ma >> 1;
  }
  vector<int> count_1(siz, 0);
  for (int i = 0; i < n; i++) {
    ma = v[i];
    int curr = 0;
    while (ma >= 1) {
      if (ma & 1) {
        count_1[curr]++;
      }
      curr++;
      ma = ma >> 1;
    }
  }
  for (int i = 0; i < siz; i++) {
    cerr << "count_1[i]" << count_1[i] << "\n";
    ans += (((abs(count_1[i] - n) * count_1[i]) % mod) * (pow[i] % mod)) % mod;
  }
  cout << ans;
}
