#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long bit[300010][70];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = (0); i < (n); i++) cin >> a[i];
  for (long long i = (0); i < (n); i++) {
    long long tmp = a[i], cnt = 0;
    while (tmp > 0) {
      if (tmp % 2) bit[i][cnt] = 1;
      tmp /= 2;
      cnt++;
    }
  }
  long long ans = 0, num = 1;
  for (long long i = (0); i < (70); i++) {
    long long cnt = 0;
    for (long long j = (0); j < (n); j++) cnt += bit[j][i];
    long long sum = (cnt * (n - cnt)) % mod;
    (ans += (num * sum) % mod) %= mod;
    num *= 2;
  }
  cout << ans << endl;
}
