#include <bits/stdc++.h>
using namespace std;
int a[62];
int b[62];
int c[62];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    int cnt = 0;
    for (int i = 0; i < 62; ++i) {
      if (x & 1)
        a[cnt]++;
      else
        b[cnt]++;
      x >>= 1;
      cnt++;
    }
  }
  for (int i = 0; i < 62; ++i) {
    c[i] = a[i] * b[i];
  }
  long long all = 0;
  for (int i = 0; i < 62; ++i) {
    all = (all + c[i] * ((1ll << (i * 1ll)) % 1000000007)) % 1000000007;
  }
  printf("%lld\n", all);
  return 0;
}
