#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
template <typename T>
void setmax(T& x, T y) {
  x = max(x, y);
}
template <typename T>
void setmin(T& x, T y) {
  x = min(x, y);
}
map<int, int> mem;
int q(int y) {
  cout << y << endl;
  string s;
  cin >> s;
  int a = -1;
  if (s == "Male")
    return 1;
  else if (s == "Female")
    return 2;
  else {
    exit(0);
  }
}
const long long m = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < int(n); i++) cin >> a[i];
  long long ans = 0;
  long long cur = 0;
  for (int i = 0; i < int(61); i++) {
    int o = 0;
    for (int j = 0; j < int(n); j++) o += (a[j] >> i) & 1;
    cur = (n - o) * o;
    cur %= m;
    ans += ((1ll << i) % m) * cur;
    ans %= m;
  }
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  int t = 1;
  for (int i = 0; i < int(t); i++) {
    solve();
  }
}
