#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T& a, T b) {
  return (a = max(a, b)) == b;
}
template <class T>
bool chmin(T& a, T b) {
  return (a = min(a, b)) == b;
}
const long long INF = 1e18, MOD = 1e9 + 7;
signed main() {
  cin.tie(0), cout.tie(0), ios::sync_with_stdio(false),
      cout << fixed << setprecision(20);
  ;
  long long n, a, res = 0;
  cin >> n;
  long long cnt[66][2] = {};
  while (n--) {
    cin >> a;
    for (long long i = (long long)(0); i < (long long)(61); i++) {
      cnt[i][a >> i & 1]++;
    }
  }
  for (long long i = (long long)(0); i < (long long)(61); i++) {
    res += (long long)pow(2, i) * cnt[i][0] * cnt[i][1];
    res %= MOD;
  }
  cout << res << endl;
}
