#include <bits/stdc++.h>
using namespace std;
long long int fac[2000000 + 1];
long long int inv[2000000 + 1];
long long int finv[2000000 + 1];
long long int comb(long long int n, long long int k) {
  return (((fac[n] * finv[n - k]) % 1000000007) * finv[k]) % 1000000007;
}
void init() {
  fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
  for (int i = 2; i <= 2000000; i++) {
    fac[i] = (fac[i - 1] * i) % 1000000007;
    inv[i] =
        ((-(1000000007 / i) * inv[1000000007 % i]) % 1000000007 + 1000000007) %
        1000000007;
    finv[i] = (finv[i - 1] * inv[i]) % 1000000007;
  }
}
long long int pp(long long int a, long long int b) {
  return (a * b) % 1000000007;
}
int main(int argc, char const *argv[]) {
  long long int n;
  std::cin >> n;
  long long int ans = 0;
  init();
  std::vector<long long int> a(n);
  vector<vector<long long int> > d =
      vector<vector<long long int> >(n, vector<long long int>(62, 0));
  for (int i = 0; i < n; i++) std::cin >> a[i];
  for (int i = 0; i < n; i++) {
    long long int tmp = a[i];
    long long int c = 0;
    while (tmp > 0) {
      if (tmp % 2 == 1) d[i][c] = 1;
      c++, tmp /= 2;
    }
  }
  std::vector<long long int> rui(63, 1);
  for (int i = 1; i < 62; i++) rui[i] = (rui[i - 1] * 2) % 1000000007;
  for (int i = 0; i < 62; i++) {
    long long int c = 0;
    for (int j = 0; j < n; j++)
      if (d[j][i] == 1) c++;
    ans = (ans + pp(rui[i], (n - c) * c)) % 1000000007;
  }
  std::cout << ans << '\n';
  return 0;
}
