#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(const T x, const T y) {
  if (!y) {
    return x;
  }
  return gcd(y, x % y);
}
template <class T>
T lcm(const T x, const T y) {
  return x / gcd(x, y) * y;
};
template <class T>
T modpow(const T x, const T n, const T mod) {
  T res = 1;
  while (n > 0) {
    if (n % 2) res = res * x % mod;
    x = x * x % mod;
    n /= 2;
  };
  return res;
}
template <class T>
bool alltrue(const T &a) {
  return all_of((a).begin(), (a).end(), [](bool x) { return x; });
}
template <class T>
bool anytrue(const T &a) {
  return any_of((a).begin(), (a).end(), [](bool x) { return x; });
}
template <class T>
bool contain(const T &a, const T &b) {
  for (auto x : b) {
    if (a.find(x) == a.end()) {
      return false;
    }
  }
  return true;
}
template <class T>
bool mmax(T &m, const T q) {
  if (m < q) {
    m = q;
    return true;
  } else
    return false;
}
template <class T>
bool mmin(T &m, const T q) {
  if (m > q) {
    m = q;
    return true;
  } else
    return false;
}
template <class T>
int siz(const T &a) {
  return (int)a.size();
}
template <class T>
set<T> devisers(T n) {
  set<T> res;
  for (T i = 1; i < (T)sqrt(n) + 1; i++) {
    if (n % i == 0) {
      res.insert(i);
      res.insert(n / i);
    }
  }
  return res;
}
template <class T>
void concat(T &a, const T &b) {
  a.insert(a.end(), b.begin(), b.end());
}
template <class T>
void getand(const T &a, const T &b, T &c) {
  set_intersection(a.begin(), a.end(), b.begin(), b.end(),
                   inserter(c, c.end()));
}
template <class T>
void getor(const T &a, const T &b, T &c) {
  set_union(a.begin(), a.end(), b.begin(), b.end(), inserter(c, c.end()));
}
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 100;
string to_binary(long long a) {
  if (a == 0) return "0";
  string res;
  while (a > 0) {
    a % 2 == 1 ? res.push_back('1') : res.push_back('0');
    a /= 2;
  }
  reverse((res).begin(), (res).end());
  return res;
}
int main() {
  long long N;
  cin >> N;
  vector<long long> AS(N);
  for (long long i = (long long)(0); i < (long long)(N); ++i) cin >> AS[i];
  long long ans = 0;
  for (long long com = (long long)(0); com < (long long)(60); ++com) {
    long long COM = 1LL << com;
    long long one = 0;
    for (long long i = (long long)(0); i < (long long)(N); ++i)
      if (AS[i] & COM) one++;
    ans += one * (N - one) * COM;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
