#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < (int)(n); i++) cin >> v[i];
  long long ans = 0;
  for (long long bit = 0; bit <= 60; bit++) {
    long long one = 0, zero = 0;
    for (int i = 0; i < (int)(n); i++) {
      if (v[i] & 1LL << bit)
        one++;
      else
        zero++;
    }
    ans += one * zero * ((1LL << bit) % mod);
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
