#include <bits/stdc++.h>
using namespace std;
long long newton(long long int a, long long int b) {
  if (a == b) return a;
  while (a != 0 && b != 0) {
    if (a > b) {
      b += a;
      a = b - a;
      b -= a;
    }
    b %= a;
  }
  return a;
}
struct UnionFind {
  vector<int> p;
  UnionFind(int N) : p(N) {
    for (int i = 0; i < N; i++) {
      p[i] = i;
    }
  }
  int root(int x) {
    if (p[x] == x) return x;
    return p[x] = root(p[x]);
  }
  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    p[rx] = ry;
  }
  bool issame(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};
long long div2mul_calc(long long a, long long b, long long m) {
  if (b == 0) {
    return 1;
  } else if (b % 2 == 0) {
    long long d = div2mul_calc(a, b / 2, m);
    return (d * d) % m;
  } else {
    return (a * div2mul_calc(a, b - 1, m)) % m;
  }
}
long long div2mul(long long n, long long mod) {
  return div2mul_calc(n, mod - 2, mod);
}
long long twoRow(long long a, long long b, long long mod) {
  long long ret = 1;
  for (long long i = 1; i <= a + b; ++i) {
    ret *= i;
    ret %= mod;
  }
  for (long long i = 1; i <= a; ++i) {
    ret *= div2mul(i, mod);
    ret %= mod;
  }
  for (long long i = 1; i <= b; ++i) {
    ret *= div2mul(i, mod);
    ret %= mod;
  }
  return ret;
}
struct edge {
  int from;
  int to;
  int cost;
};
vector<long long> divisor(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end());
  return (ret);
}
long long mp[40000][10] = {0};
long long two[40000][100] = {0};
long long ans[1000] = {0};
int main() {
  long long i, j, k, a, b, ans = 0;
  char c;
  long long N, M, T, X, Y;
  cin >> N;
  long long mp[64] = {0};
  for (i = 0; i < N; ++i) {
    cin >> j;
    for (k = 0; k < 62; ++k) {
      if (j & 1) mp[k]++;
      j >>= 1;
    }
  }
  for (i = 0; i < 62; ++i) {
    k = mp[i] * (N - mp[i]);
    k <<= i;
    ans += k;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
