#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> t) {
  return "(" + to_string(get<0>(t)) + ", " + to_string(get<1>(t)) + ", " +
         to_string(get<2>(t)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> t) {
  return "(" + to_string(get<0>(t)) + ", " + to_string(get<1>(t)) + ", " +
         to_string(get<2>(t)) + ", " + to_string(get<3>(t)) + ")";
}
template <typename A>
string to_string(vector<A> v) {
  bool first = true;
  string result = "[";
  for (A i : v) {
    if (!first) result += ", ";
    first = false;
    result += to_string(i);
  }
  return result + "]";
}
template <typename A>
string to_string(A x[], long long n) {
  string result = "{";
  for (long long i = (0); i < (n); ++i) {
    if (i != 0) result += ", ";
    result += to_string(x[i]);
  }
  return result + "}";
}
string bin_string(long long x) {
  const long long d = 64;
  string result(d, ' ');
  for (long long i = (d - 1); i > (-1); --i)
    result[d - 1 - i] = '0' + ((x & 1LL << i) != 0);
  return result;
}
vector<long long> getZ(string s) {
  long long n = s.size();
  vector<long long> z(n);
  long long x = 0, y = 0;
  for (long long i = (1); i < (n); ++i) {
    z[i] = max(0LL, min(z[i - x], y - i + 1));
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) {
      x = i;
      y = i + z[i];
      ++z[i];
    }
  }
  return z;
}
long long powa(long long base, long long exp) {
  if (exp <= 0) return 1;
  if (base <= 0) return 0;
  long long val = powa(base, exp >> 1);
  val = val * val % MOD;
  if (exp & 1) {
    val = val * base % MOD;
  }
  return val;
}
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = (0); i < (n); ++i) cin >> a[i];
  long long res = 0;
  long long tk = 1;
  for (long long d = (0); d < (60); ++d) {
    long long cnt[2] = {};
    for (long long i : a) ++cnt[(i & 1LL << d) != 0];
    res += cnt[0] * cnt[1] % MOD * tk % MOD;
    tk = (tk + tk) % MOD;
  }
  cout << res;
}
