#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) cin >> v[i];
  long long int sum = 0, mod = 1e9 + 7;
  for (long long int i = 0; i < 64; i++) {
    long long int zero = 0, one = 0;
    for (long long int j = 0; j < n; j++) {
      if (v[j] & (1LL << i))
        one++;
      else
        zero++;
    }
    sum += (zero * one * (1LL << i)) % mod;
  }
  cout << sum % mod << '\n';
  return 0;
}
