#include <bits/stdc++.h>
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}
template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}
template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}
void debug_out() { std::cerr << '\n'; }
template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;
void convert_to_binary(int64 n, vector<int>& kurai) {
  int64 amari = 0;
  int idx = 0;
  while (n != 1) {
    amari = n % 2;
    n = n / 2;
    kurai[idx] = amari;
    idx++;
  }
  kurai[idx] = 1;
}
int main() {
  int64 divide_by = 1e9 + 7;
  int64 N;
  cin >> N;
  vector<int64> A(N);
  cin >> A;
  vector<vector<int>> kurai_store(N, vector<int>(61));
  for (int i = 0; i < N; i++) {
    convert_to_binary(A[i], kurai_store[i]);
  };
  int64 ans = 0;
  for (int i = 0; i < 61; i++) {
    int64 sm = 0;
    for (int j = 0; j < N; j++) {
      sm += kurai_store[j][i];
    }
    ans += sm * (N - sm) * pow(2LL, i);
    ans %= divide_by;
  }
  cout << ans << endl;
  return 0;
}
