#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long solve(vector<long long> v) {
  long long sum = 0, cnt0, cnt1;
  for (int i = 0; i <= 60; i++) {
    cnt0 = 0, cnt1 = 0;
    for (int j = 0; j < v.size(); j++) {
      long long x = v[j] % 2;
      v[j] /= 2;
      if (x % 2 == 0)
        cnt0++;
      else
        cnt1++;
    }
    sum = (sum + ((cnt0 * cnt1) % mod) * (1LL << i)) % mod;
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  while (cin >> n) {
    vector<long long> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    long long ans = solve(v);
    cout << ans << endl;
  }
  return 0;
}
