#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int inf = 1e9;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
int main() {
  int n;
  cin >> n;
  long long zero[65] = {}, one[65] = {};
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    bitset<60> a_bit(a);
    for (int j = 0; j < 60; j++) {
      if (a_bit[j])
        one[j]++;
      else {
        zero[j]++;
      }
    }
  }
  long long sum = 1;
  const long long mod = 1e9 + 7;
  for (int i = 0; i < 60; i++) {
    ans = (ans + one[i] * zero[i] * sum % mod) % mod;
    sum = sum * 2 % mod;
  }
  cout << ans << "\n";
}
