#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}";
  return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
    os << *itr;
    itr++;
    if (itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
    os << *itr;
    itr++;
    if (itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
void dump_func() { cout << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&...tail) {
  cout << head;
  if (sizeof...(Tail) > 0) {
    cout << ", ";
  }
  dump_func(std::move(tail)...);
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct aaa {
  aaa() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} aaaaaaa;
signed main() {
  const unsigned long long int MOD = 1000000007;
  int N;
  cin >> N;
  vector<unsigned long long int> A(N);
  cin >> A;
  unsigned long long int ans = 0;
  for (int b = 0, b_len = (60); b < b_len; ++b) {
    int cnt0 = 0, cnt1 = 0;
    for (int i = 0, i_len = (N); i < i_len; ++i) {
      if ((A[i] >> b) & 1LL)
        cnt1++;
      else
        cnt0++;
    }
    unsigned long long int cnt = (cnt0 * cnt1);
    unsigned long long int tmp = 0;
    for (int i = b, i_end = (60); i < i_end; i += 1) {
      if (cnt & 1) {
        tmp = ((1LL << i) % MOD) + tmp;
        tmp %= MOD;
      }
      cnt = cnt >> 1;
    }
    ans = (ans + tmp) % MOD;
  }
  cout << ans << endl;
}
