#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int maxn = 300005;
int sumr[maxn][64][2] = {0};
long long a[maxn] = {0};
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (int i = n - 1; i >= 0; --i) {
    int j = 0;
    long long d = a[i];
    for (int j = 0; j <= 60; j++) {
      sumr[i][j][0] = sumr[i + 1][j][0];
      sumr[i][j][1] = sumr[i + 1][j][1];
      if (d % 2) {
        sumr[i][j][1]++;
      } else
        sumr[i][j][0]++;
      d /= 2;
    }
  }
  long long num[63] = {0};
  num[0] = 1;
  for (int i = 1; i < 61; i++) {
    num[i] = num[i - 1] * 2 % mod;
  }
  long long ans = 0;
  for (int i = 0; i < n - 1; ++i) {
    int j = 0;
    long long d = a[i];
    for (int j = 0; j < 61; j++) {
      if (d % 2)
        ans = ans + (sumr[i + 1][j][0] * num[j] % mod) % mod;
      else
        ans = ans + (sumr[i + 1][j][1] * num[j] % mod) % mod;
      d /= 2;
    }
  }
  cout << ans << endl;
  return 0;
}
