#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long m, long long mod) {
  long long ans = 1;
  while (m) {
    if (m % 2) {
      ans *= a;
      ans %= (mod);
    }
    a = (a * a) % (mod);
    m >>= 1;
  }
  return ans;
}
void init(long long* a, long long n, long long val) {
  for (long long i = 0; i < n; i++) a[i] = val;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1, i, j;
  long long n;
  cin >> n;
  long long a;
  long long c[62] = {0};
  for (i = 0; i < n; i++) {
    cin >> a;
    for (j = 1; j <= a; j = j << 1) {
      if (j & a) c[(long long)log2(j)]++;
    }
  }
  long long ans = 0, k;
  for (i = 0; i < 62; i++) {
    k = c[i] * (n - c[i]);
    k %= 1000000007;
    ans += k * pow(2, i);
    ans %= 1000000007;
  }
  cout << ans;
  return 0;
}
