#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
struct io {
  io() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  };
};
const long long int MOD = 1000000007;
const int INF = INT_MAX;
const long long int LLINF = 1LL << 62;
int main(void) {
  long long int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < (n); ++i) cin >> v[i];
  vector<string> a(n);
  for (int i = 0; i < (n); ++i) {
    string s = "";
    while (v[i] > 0) {
      s += '0' + v[i] % 2;
      v[i] /= 2;
    }
    while (s.size() <= 61) {
      s += '0';
    }
    a[i] = s;
  }
  long long int ans = 0;
  for (int i = 0; i < (a[0].size()); ++i) {
    long long int zero = 0, iti = 0;
    for (int j = 0; j < (n); ++j) {
      if (a[j][i] == '0')
        zero++;
      else
        iti++;
    }
    ans += ((zero * iti % MOD) * ((long long int)pow(2, i) % MOD)) % MOD;
    ans %= MOD;
  }
  cout << (ans) << endl;
}
