#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b, long long m = 1000000007) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long one[64];
  long long zero[64];
  for (int i = 0; i < n; i++) {
    long long y = a[i];
    long long k = 0;
    while (y != 0) {
      if (y & 1) {
        one[k]++;
      } else {
        zero[k]++;
      }
      y /= 2;
      k++;
    }
    for (long long j = k; j <= 63; j += 1) {
      zero[j]++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 64; i++) {
    if (one[i] != 0 && zero[i] != 0) {
      long long s = (one[i] % 1000000007 * zero[i] % 1000000007) % 1000000007;
      s = (s % 1000000007 * power(2, i, 1000000007) % 1000000007) % 1000000007;
      ans = (ans % 1000000007 + s % 1000000007) % 1000000007;
    }
  }
  cout << ans;
  return 0;
}
