#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  int N;
  cin >> N;
  long long A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long sum = 0;
  for (long long d = 0; d < 60; d++) {
    long long count0 = 0;
    long long count1 = 0;
    for (long long i = 0; i < N; i++) {
      if ((A[i] >> d) & 1LL) {
        count1++;
      } else {
        count0++;
      }
    }
    sum = (sum % mod) + (count0 * count1 * ((1LL << d) % mod)) % mod;
  }
  cout << sum % mod << endl;
  return 0;
}
