#include <bits/stdc++.h>
using namespace std;
int n;
long long get() {
  char c = getchar();
  long long x = 0LL;
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    x *= 10LL;
    x += (c - '0');
    c = getchar();
  }
  return x;
}
char c[300000][61];
int z(long long x, int i) {
  string s;
  for (int j = 0; j < 61; j++) c[i][j] = '0';
  while (x) {
    int b = (int)(x % 2ll);
    s += (b + '0');
    x /= 2ll;
  }
  for (int j = 0; j < s.size(); j++) c[i][j] = s[j];
  return s.size();
}
long long x;
long long t[61];
int mx = 0;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    x = get();
    mx = max(mx, z(x, i));
  }
  long long ans = 0ll, now = 1ll;
  for (int i = 0; i < 61; i++) {
    t[i] = now;
    now *= 2ll;
  }
  for (int i = 0; i < mx; i++) {
    int z = 0, o = 0;
    for (int j = 0; j < n; j++)
      if (c[j][i] == '0')
        z++;
      else
        o++;
    long long aa = (long long)((long long)(z) * (long long)(o));
    aa %= (long long)(1000000007);
    if (i == 0)
      aa *= t[i];
    else {
      aa *= t[i - 1];
      aa %= (long long)(1000000007);
      aa *= 2;
    }
    aa %= (long long)(1000000007);
    ans += aa;
    ans %= (long long)(1000000007);
  }
  cout << ans;
  return 0;
}
