#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int dx[] = {0, 0, 1, -1, -1, 1, -1, 1};
int dy[] = {-1, 1, 0, 0, 1, 1, -1, -1};
int dz[] = {0, 0, 1, -1, -1, 1, -1, 1};
int kx[] = {2, 2, -2, -2, 1, -1, 1, -1};
int ky[] = {1, -1, 1, -1, 2, 2, -2, -2};
template <typename T>
void print(const T& x) {
  cerr << x << ' ';
}
template <typename T1, typename... T2>
void print(const T1& first, const T2&... rest) {
  print(first);
  print(rest...);
}
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(long long N, long long pos) {
  return (bool)(N & ((long long)1LL << pos));
}
bool isPal(string s) {
  int half = s.size() / 2;
  for (int i = 0, j = s.size() - 1; i < half; i++, j--)
    if (s[i] != s[j]) return false;
  return true;
}
double _distance(double x1, double y1, double x2, double y2) {
  double x1x2 = x1 - x2;
  double y1y2 = y1 - y2;
  return sqrt((x1x2 * x1x2) + (y1y2 * y1y2));
}
bool inBound(int x, int y, int r, int c) {
  return (x >= 0 && x < r && y >= 0 && y < c);
}
long long mulmod(long long a, long long b, long long c) {
  long long x = 0, y = a % c;
  while (b > 0) {
    if (b & 1) x = (x + y) % c;
    y = (y << 1) % c;
    b >>= 1;
  }
  return x % c;
}
long long o[65], z[65];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  long long n, x, m = 1e9 + 7;
  unsigned long long p[65];
  p[0] = 1;
  for (int i = 1; i <= 64; i++) {
    p[i] = 2 * p[i - 1];
    p[i] %= m;
    p[i] += m;
    p[i] %= m;
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    for (int j = 63; j >= 0; j--) {
      if (check(x, j))
        o[j]++;
      else
        z[j]++;
    }
  }
  long long ans = 0;
  for (long long i = 63; i >= 0; i--) {
    ans += (o[i] * z[i] * p[i]) % m;
    ans = (ans + m) % m;
  }
  cout << ans << endl;
  return 0;
}
