#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
const long long int INF = 1e18;
const long long int maxn = 1e6 + 4;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  vector<int> bits(66);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    long long int k = v[i];
    int j = 0;
    while (k > 0) {
      bits[j++] += (k % 2);
      k /= 2;
    }
  }
  vector<long long int> ans(66);
  int lst = 0;
  for (int i = 0; i <= 65; i++) {
    long long int k = bits[i] * (n - bits[i]);
    long long int temp = k + ans[i];
    ans[i] = (temp) % 2;
    ans[i + 1] += (temp) / 2;
  }
  long long int finalans = 0;
  long long int prod = 1;
  for (int i = 0; i <= 65; i++) {
    finalans = (finalans + (ans[i] % MOD * prod % MOD) % MOD) % MOD;
    prod = (prod % MOD * 2LL) % MOD;
  }
  cout << finalans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  cerr << endl
       << "[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
}
