#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using pli = pair<long long, int>;
using pll = pair<long long, long long>;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
const int mod = 1e9 + 7;
long long power(long long a, long long b) {
  long long ans = 1 % mod;
  while (b > 0) {
    if (b & 1) {
      ans = ans * a % mod;
    }
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setiosflags(ios::fixed) << setprecision(12);
  int n;
  cin >> n;
  vector<long long> a(n + 1);
  long long mx = -1;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  int len = 0;
  while (mx) {
    mx = mx >>= 1;
    len++;
  }
  vector<long long> cnt0(len + 1), cnt1(len + 1);
  for (int i = 1; i <= n; i++) {
    long long cur = a[i];
    int t = 0;
    for (int j = 0; j < len; j++) {
      if (cur >> j & 1) {
        cnt1[j]++;
      } else {
        cnt0[j]++;
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < len; i++) {
    ans = (ans + cnt0[i] * cnt1[i] * power(2, i)) % mod;
  }
  cout << ans << "\n";
  return 0;
}
