#include <bits/stdc++.h>
using namespace std;
long long a[62];
long long b[62];
long long c[62];
const long long mod = 1e9 + 7;
inline long long ksc(long long x, long long y, long long p) {
  long long z = (long double)x / p * y;
  long long res = (unsigned long long)x * y - (unsigned long long)z * p;
  return (res + p) % p;
}
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 + ksc(1ll * c[i], (1ll << i), mod)) % mod;
  }
  printf("%lld\n", all);
  return 0;
}
