#include <bits/stdc++.h>
using namespace std;
using P = pair<long long, long long>;
const long long mod = 1e9 + 7;
template <class T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}
template <class T>
inline void chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
}
template <class T>
inline void chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
}
inline long long modu(long long a) { return (a % mod + mod) % mod; }
long long modpow(long long a, long long b) {
  long long res = 1;
  for (a = modu(a); b; a = modu(a * a), b >>= 1) {
    if (b & 1) res = modu(res * a);
  }
  return res;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N = in();
  vector<long long> A(N);
  for (long long(i) = 0; (i) < (N); (i)++) A[i] = in<long long>();
  long long answer = 0;
  for (long long(i) = 0; (i) < (61); (i)++) {
    int sum = 0;
    for (long long(l) = 0; (l) < (N); (l)++) {
      if (A[l] & 1LL << i) sum++;
    }
    answer = modu(answer + sum * (N - sum) * modpow(2, i));
  }
  cout << answer << "\n";
}
