#include <bits/stdc++.h>
using namespace std;
const long long MM = 1000000000;
long long mod = MM + 7;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 1LL << 60;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long count = 0;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < 100; i++) {
    long long cnt0 = 0, cnt1 = 0;
    for (long long j = 0; j < n; j++) {
      if (a[j] % 2 == 0)
        cnt0++;
      else
        cnt1++;
      a[j] /= 2;
    }
    long long a = cnt0 * cnt1;
    a %= mod;
    a *= (long long)pow(2, i);
    a %= mod;
    count += a;
    count %= mod;
  }
  cout << count << endl;
}
