#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = (1ll << 60);
template <class T>
bool umax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool umin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int findGCD(vector<int> arr) {
  int result = arr[0];
  for (auto a : arr) {
    result = gcd(a, result);
  }
  return result;
}
template <typename T>
T lcm(T m, T n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  fill((T *)array, (T *)(array + N), val);
}
int dx[5] = {1, 0, -1, 0};
int dy[5] = {0, 1, 0, -1};
class Combination {
  long long powmod(long long a, long long p) {
    long long ans = 1LL;
    long long mul = a;
    while (p > 0) {
      if ((p & 1) == 1) {
        ans = (ans * mul) % MOD;
      }
      mul = (mul * mul) % MOD;
      p >>= 1;
    }
    return ans;
  }

 public:
  int N;
  long long mod;
  vector<long long> fact;
  vector<long long> revfact;
  Combination(long long n, long long m)
      : N(n), mod(m), fact(n + 1), revfact(n + 1) {
    fact[0] = 1;
    for (int i = 1; i <= N; i++) {
      fact[i] = fact[i - 1] * i;
      fact[i] %= mod;
    }
    revfact[N] = powmod(fact[N], mod - 2);
    for (int i = N - 1; i >= 0; i--) {
      revfact[i] = revfact[i + 1] * (i + 1) % mod;
    }
  }
  long long getCombination(long long a, long long b) {
    if (a < 0 || b < 0) return 0;
    if (b > a) return 0;
    return fact[a] * revfact[b] % mod * revfact[a - b] % mod;
  }
};
const int mod = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  mint &operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
long long table[300010][61];
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  vector<long long> sum(N + 1, 0LL);
  for (int i = 0; i < (int)(N); i++) {
    cin >> A[i];
  }
  Fill(table, 0LL);
  for (int j = 0; j < N; j++) {
    for (int i = 0; i <= 60; i++) {
      if ((A[j] >> i) & 1) {
        table[j + 1][i] = table[j][i] + 1;
      } else {
        table[j + 1][i] = table[j][i];
      }
    }
  }
  long long ans = 0LL;
  for (int j = 0; j <= 60; j++) {
    ans += (1 << j) % MOD * table[N][j] * (N - table[N][j]);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
