#include <bits/stdc++.h>
using namespace std;
template <class T>
using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T1, class T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &a) {
  return out << '(' << a.first << ", " << a.second << ')';
}
template <class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &a) {
  return in >> a.first >> a.second;
}
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
void run() {
  int n;
  cin >> n;
  vector<int> cnt0(64, 0), cnt1(64, 0);
  while (n--) {
    long long first;
    cin >> first;
    for (auto i = (0); i != (64); ++i) {
      if (first & 1)
        cnt0[i]++;
      else
        cnt1[i]++;
      first >>= 1;
    }
  }
  const long long mod = 1e9 + 7;
  long long answer = 0;
  long long p2 = 1LL;
  for (auto i = (0); i != (64); ++i) {
    answer += p2 * (cnt0[i] * cnt1[i] % mod);
    answer %= mod;
    p2 = (p2 + p2);
    if (p2 >= mod) p2 -= mod;
  }
  cout << answer << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cerr << boolalpha;
  (cout << fixed).precision(10);
  run();
  return 0;
}
