#include <bits/stdc++.h>
using namespace std;
void Main() {
  long long int n;
  cin >> n;
  vector<long long int> A(n);
  for (long long int i = 0; i < (long long int)(n); i++) cin >> A[i];
  long long int pow2 = 1;
  long long int sum = 0;
  long long int mod = 7LL + 1e9;
  for (long long int _i = 0; _i < (long long int)(61); _i++) {
    long long int one = 0, zero = 0;
    for (long long int i = 0; i < (long long int)(n); i++) {
      long long int v = A[i] % 2;
      if (v == 1)
        one++;
      else
        zero++;
      A[i] /= 2;
    }
    sum += (one * zero % mod) * pow2 % mod;
    sum %= mod;
    pow2 *= 2;
  }
  cout << sum << endl;
  ;
}
signed main() {
  Main();
  return 0;
}
