#include <bits/stdc++.h>
using namespace std;
template <class T>
istream& operator>>(istream& s, vector<T>& v) {
  for (T& x : v) {
    s >> x;
  }
  return s;
}
template <class T>
void cout_h(const vector<T>& c) {
  for (int i = 0; i < c.size(); i++)
    cout << c[i] << (i == c.size() - 1 ? "\n" : " ");
}
template <class INT_T>
INT_T modpow(INT_T b, INT_T x, INT_T mod) {
  if (x == 0) return 1;
  if (x & 1) {
    return modpow(b * b % mod, x / 2, mod) * b % mod;
  } else {
    return modpow(b * b % mod, x / 2, mod);
  }
}
template <class INT_T>
INT_T powi(INT_T b, INT_T x) {
  if (x == 0) return 1;
  if (x == 1) return b;
  if (x & 1) return powi(b * b, x / 2) * b;
  return powi(b * b, x / 2);
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  unsigned long long N;
  cin >> N;
  vector<unsigned long long> popcnt(61, 0);
  for (unsigned long long i = 0; i < N; i++) {
    unsigned long long a;
    cin >> a;
    unsigned long long m = 1;
    for (unsigned long long b = 0; b < 61; b++) {
      if (a & m) popcnt[b]++;
      m <<= 1;
    }
  }
  unsigned long long ans = 0;
  for (unsigned long long b = 0; b < 61; b++) {
    ans = (ans + popcnt[b] * (N - popcnt[b]) *
                     modpow((unsigned long long)2, (unsigned long long)b,
                            (unsigned long long)1000000007) %
                     1000000007) %
          1000000007;
  }
  cout << ans << endl;
}
