#include <bits/stdc++.h>
using namespace std;
long long xor_sum4(int n, long long a[]) {
  long long divider = 1000000007;
  vector<bitset<60>> ba;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    bitset<60> b = a[i];
    ba.push_back(b);
  }
  for (int i = 0; i < 60; i++) {
    long long count_zero = 0;
    long long count_one = 0;
    for (int j = 0; j < ba.size(); j++) {
      bitset<60> b = ba[j];
      if (b[i] == 0)
        count_zero++;
      else
        count_one++;
    }
    long long adder = (count_one * count_zero) * pow(2, i);
    adder = adder % divider;
    ans += adder;
    ans = ans % divider;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  auto ans = xor_sum4(n, a);
  cout << ans;
}
