#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const long long MOD = (long long)1000000007;
const long long INF2 = (long long)100000000000000000;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  long long t = 1;
  long long cnt = 0;
  vector<long long> ratio(65);
  ratio[0] = 1;
  while (mx > t) {
    cnt++;
    t *= 2LL;
    ratio[cnt] = t;
  }
  cnt++;
  vector<long long> tp(cnt);
  vector<long long> tm(cnt);
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < cnt; j++) {
      if (a[i] & (1LL << j)) {
        tp[j]++;
      } else {
        tm[j]++;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < cnt; j++) {
      if (a[i] & (1LL << j)) {
        long long x = tm[j];
        long long r = ratio[j];
        x *= r;
        ans += x;
        ans %= MOD;
      } else {
        long long x = tp[j];
        long long r = ratio[j];
        x *= r;
        ans += x;
        ans %= MOD;
      }
    }
  }
  cout << ans / 2 << endl;
  return 0;
}
