#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int one[101], zero[101];
  long long m = -1LL;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    m = max(m, x);
    int j = 0;
    while (j < 100) {
      int bit = x & 1;
      if (bit & 1)
        one[j]++;
      else
        zero[j]++;
      j++;
      x >>= 1;
    }
  }
  int cnt = 0;
  while (m > 0) {
    cnt++;
    m >>= 1;
  }
  long long res = 0LL;
  for (int i = 0; i < cnt; i++) {
    res += 1LL * one[i] * zero[i] * (1 << i);
    res = res % (1000 * 1000 * 1000 + 7) * 1LL;
  }
  cout << res;
  return 0;
}
