#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int sum1[300005][70], sum0[300005][70], n;
long long a[300005], er[70], ans[70];
int main() {
  scanf("%d", &n);
  er[0] = 1;
  for (int i = 1; i <= 65; i++) er[i] = er[i - 1] * 2 % mod;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    long long ss = a[i];
    for (int j = 0; j <= 61; j++) {
      if (ss & 1)
        sum1[i][j]++;
      else
        sum0[i][j]++;
      ss >>= 1;
    }
  }
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    long long ss = a[i];
    for (int j = 0; j <= 61; j++) {
      if (ss & 1)
        ans[j] += sum0[i - 1][j];
      else
        ans[j] += sum1[i - 1][j];
      sum1[i][j] += sum1[i - 1][j];
      sum0[i][j] += sum0[i - 1][j];
      ss >>= 1;
    }
  }
  for (int i = 0; i <= 61; i++) sum = (sum + ans[i] * er[i] % mod) % mod;
  printf("%lld\n", sum);
  return 0;
}
