#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long P[70];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  P[0] = 1;
  for (int i = 1; i < (70); ++i) (P[i] = P[i - 1] * 2) %= (int)(1e9 + 7);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  long long ans2 = 0;
  for (int i = 0; i < (n); ++i)
    (ans2 += (long long)(n - 1) * a[i] % (int)(1e9 + 7)) %= (int)(1e9 + 7);
  long long ans = 0;
  vector<long long> table(70);
  for (int i = 0; i < (n); ++i) {
    int keta = 0;
    while (a[i]) {
      if (a[i] % 2) table[keta]++;
      keta++;
      a[i] /= 2;
    }
  }
  for (int i = 0; i < (70); ++i) {
    if (table[i])
      (ans += P[i + 1] * (table[i] * (table[i] - 1) / 2) % (int)(1e9 + 7)) %=
          (int)(1e9 + 7);
  }
  cout << (ans2 - ans % (int)(1e9 + 7) + (int)(1e9 + 7)) % (int)(1e9 + 7)
       << endl;
}
