#include <bits/stdc++.h>
using namespace std;
int get_int() {
  int x;
  scanf("%d", &x);
  return x;
}
long long get_ll() {
  long long x;
  scanf("%lld", &x);
  return x;
}
double get_db() {
  double x;
  scanf("%lf", &x);
  return x;
}
template <typename T>
int chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  } else
    return 0;
}
template <typename T>
int chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  } else
    return 0;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (int i = (0); i < (v.size()); i++) os << v[i] << " ";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  for (auto a : v) os << a << " ";
  return os;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& v) {
  os << v.first << " " << v.second << " ";
  return os;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& os, const map<T1, T2>& v) {
  for (auto a : v) cout << a << endl;
  return os;
}
static const int dx[8] = {-1, 0, 1, 0, 1, -1, 1, -1};
static const int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
const double pi = acos(-1.0);
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
long long cnt[64][2];
long long val[64];
long long A[64];
int N;
void split(long long num) {
  for (int i = (0); i < (61); i++) {
    if ((num >> i) & 1LL) {
      cnt[i][1]++;
    } else {
      cnt[i][0]++;
    }
  }
}
int cal(long long num) {
  long long ret = 0;
  for (int i = (0); i < (61); i++) {
    if ((num >> i) & 1LL) {
      ret = (ret + ((cnt[i][0] % mod) * (val[i] % mod)) % mod) % mod;
    } else {
      ret = (ret + ((cnt[i][1] % mod) * (val[i] % mod)) % mod) % mod;
    }
  }
  return ret;
}
int main() {
  for (int i = (0); i < (64); i++) {
    val[i] = (1LL << i);
  }
  cin >> N;
  for (int i = (0); i < (N); i++) cin >> A[i];
  long long ans = 0;
  for (int i = N - 1; i >= 0; i--) {
    ans = (ans + cal(A[i])) % mod;
    split(A[i]);
  }
  cout << ans << endl;
  return 0;
}
