#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long max = 0;
  cin >> n;
  long *a;
  a = new long[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (max < (long)(log2(a[i]) + 1)) max = (long)(log2(a[i]) + 1);
  }
  long long int ans = 0;
  int ct = 0;
  int onecount;
  int zerocount;
  while (ct < max) {
    onecount = 0;
    zerocount = 0;
    for (int i = 0; i < n; i++) {
      if ((a[i] >> ct) & 1 == 1)
        onecount += 1;
      else
        zerocount += 1;
    }
    ans += long(pow(2.0, double(ct))) * onecount * zerocount;
    ct += 1;
  }
  cout << ans % 100000007 << endl;
  return 0;
}
