#include <bits/stdc++.h>
using namespace std;
long long dy[8] = {-1, 0, 1, 0, -1, 1, 1, -1};
long long dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const long long mod = 1000000007;
const long long inf = mod * mod;
const long long d5 = 300010;
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long cnt[65];
  fill(cnt, cnt + 65, 0);
  for (auto it : a) {
    for (long long i = 0; i < 60; i++) {
      if (it & (1ll << i)) {
        cnt[i] += 1;
      }
    }
  }
  long long res = 0;
  for (long long i = 0; i < 60; i++) {
    long long t = (1ll << i);
    t %= mod;
    res += cnt[i] * (n - cnt[i]) * t;
    res %= mod;
  }
  cout << res << endl;
}
