#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const ll MOD = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vll a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  vi cnt(60);
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(60); j++) {
      if (a[i] >> j & 1) cnt[j]++;
    }
  }
  ll ans = 0;
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(60); j++) {
      ll x;
      if (a[i] >> j & 1) {
        cnt[j]--;
        x = (n - 1 - i) - cnt[j];
      } else {
        x = cnt[j];
      }
      ans += (ll)pow(2, j) * x;
      ans %= MOD;
    }
  }
  cout << ans << endl;
}
