#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int n;
int bits[100] = {0};
int cont = 0;
long long ans = 0LL;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    cont = 0;
    while (x) {
      long long y = x & 1LL;
      if (y == 1LL) (bits[cont])++;
      x = x >> 1;
      cont++;
    }
  }
  for (int i = 0; i < 64; i++) {
    int bits0 = n - bits[i];
    ans = (ans +
           ((((bits0 * bits[i]) % 1000000007LL) * ((1LL << i) % 1000000007LL)) %
            1000000007LL)) %
          1000000007LL;
  }
  cout << ans << "\n";
  return 0;
}
