#include <bits/stdc++.h>
using namespace std;
long long int num = 1e9 + 7;
long long int ex(long long int x, long long int n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 1)
    return ex(x, n - 1) * x % num;
  else
    return ex(x * x % num, n / 2) % num;
};
int main() {
  long long int n;
  cin >> n;
  long long int a[n], bit1[60], bit0[60];
  for (long long int i = 0; i < 60; i++) {
    bit1[i] = 0;
    bit0[i] = 0;
  }
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < 60; j++) {
      if (a[i] & (1ll << j)) {
        bit1[j]++;
      } else
        bit0[j]++;
    }
  }
  long long int ans = 0;
  for (long long int i = 0; i < 60; i++) {
    ans += (((bit0[i] % num) * (bit1[i] % num)) % num) % num;
    ans %= num;
    for (int j = 0; j < 1; j++) {
      ans *= 2;
      ans % num;
    }
  }
  cout << ans << endl;
}
